home *** CD-ROM | disk | FTP | other *** search
Wrap
; DEFAULT.WBT ; Whne WinBatch is executed without any parameters, it attempts to locate ; and execute this DEFAULT.WBT file. IntControl(29, @TAB, 0, 0, 0) ; standardize on tab delimters list1="WinBatch AboutBox" action1="vers" list2="System Information" action2="sysinfo" list3="WinBatch Help File" action3="wbhelp" list4="WIL Help File" action4="wilhelp" list5="Tutorial" action5="tutorial" list6="Language Changer" action6="language" list7="NWCalls Diagnostics" action7="nwcalls" list8="Ctl3D Diagnostics" action8="ctl3d" list9="Remove license Info" action9="remlic" list10="Uninstall WinBatch" action10="remove" list11="Track Mouse co-ordinates" action11="mickey" list12="Determine Owning EXE file" action12="owner" list13="Run a WBT file" action13="runwbt" ;- - - gosub initial query=list1 for xx=2 to 100 if IsDefined(list%xx%) query=strcat(query,@tab,list%xx%) else break endif next while 1 ask987=AskItemList("Running Default.wbt : Choose an option",query,@tab,@unsorted,@single) if ask987=="" then break xx987=ItemLocate(ask987,query,@tab) action=strlower(action%xx987%) gosub %action% endwhile exit ;- - - - - - - - - - - - - :remlic a=AskYesNo("WinBatch Unlicensing","Pressing YES will remove WinBatch and Compiler license information from your system.%@crlf%Do you wish to continue?") if a==@no then return if WinMetrics(-2)==2 ; 32 bit platform ErrorMode(@off) regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB32I[info]") regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC32I[info]") regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB32I[info2]") regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC32I[info2]") regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB34I[info]") regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC34I[info]") regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB34I[info2]") regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC34I[info2]") ErrorMode(@cancel) endif a=IniReadPvt("WB16I","info","XXX","WWW-PROD.INI") if a!="XXX" IniDeletePvt("WB16I","info","WWW-PROD.INI") IniDeletePvt("WB16I","info2","WWW-PROD.INI") endif a=IniReadPvt("WBC16I","info","XXX","WWW-PROD.INI") if a!="XXX" IniDeletePvt("WBC16I","info","WWW-PROD.INI") IniDeletePvt("WBC16I","info2","WWW-PROD.INI") endif return :owner a1="This option is to determine the application that has " a2="spawned a particular window in question." a3="Sometimes, some programs are actually loader programs" a4="for the 'real' application. " a5="The WinBatch AppWaitClose/AppExist functions need to know" a6="actual exe names. This script will display the" a7="Actual EXE name." text=strcat(a1,@crlf,a2,@crlf,a3,@crlf,a4,@crlf,a5,@crlf,a6,@crlf,a7) Message("EXE Finder",text) text="Put mouse over Window to determine exe file.%@crlf%Hold Shift Key down to quit the EXE finder." BoxOpen("EXE FILE FINDER","") While @TRUE ; Loop forever and ever if IsKeyDown(@SHIFT) then break WinActivate("") a=MouseInfo(1) exe=WinExeName(a) exe2=strcat(FileRoot(exe),".",FileExtension(exe)) BoxText(strcat(text,@crlf,@crlf,"EXE = ",exe2)) TimeDelay(0.5) endwhile BoxTitle("WinBatch") BoxText("WinBatch Processing") BoxShut() return :remove a=DirHome() b=FileLocate(strcat(a,"uninstal.exe")) if b=="" Message("Error",strcat("Uninatall program (uninstal.exe) not found at",@crlf,b)) return endif Run(b,"") exit :runwbt while 1 xyzzywbtfile=strlower(AskFileName("WinBatch","","WinBatch (*.WBT)|*.WBT|","*.WBT",1)) if xyzzywbtfile!="" if strcat(FileRoot(xyzzywbtfile),".",FileExtension(xyzzywbtfile))=="default.wbt" Message("Already running default.wbt","Try looking in the samples directory for sample wbt scripts to run.") continue else if strindex(xyzzywbtfile," ",0,@fwdscan)!=0 xyzzywbtfile=strcat('"',xyzzywbtfile,'"') endif run(WinExeName(""),xyzzywbtfile) exit endif return endwhile :sysinfo wintype="retail" if WinMetrics(22) then wintype="debug" wcx=WinMetrics(-3) math="Math" switch wcx case 0 ; Win16 wc=WinConfig() if !(wc&1) then mode="Real" if wc&16 then mode="Standard" if wc&32 then mode="Enhanced" if wc&64 then cpu=8086 if wc&128 then cpu=80186 if wc&2 then cpu=286 if wc&4 then cpu=386 if wc&8 then cpu=486 mode = strcat(mode,' ',wintype,' Windows ') if !(wc&1024) then math="No math" break case 1 ; Win32 Intel mode="Intel 32-bit %wintype% Windows " cpu= ItemExtract(6,WinSysInfo(),@tab) break case 2 ; Dec Alpha mode="DEC Alpha %wintype% Windows NT " cpu= ItemExtract(6,WinSysInfo(),@tab) break case 3 ; MIPS mode="MIPS %wintype% Windows NT " cpu= ItemExtract(6,WinSysInfo(),@tab) break case 4 ; PowerPC mode="PowerPC %wintype% Windows NT " cpu= ItemExtract(6,WinSysInfo(),@tab) break case wcx cpu="Unknown CPU" mode="Unknown %wintype% Windows " endswitch Sysinfo=strcat(cpu,' ',mode,WinVersion(1),'.',WinVersion(0),@CRLF) mouse="No Mouse" if WinMetrics(19) then mouse="Mouse" Sysinfo=strcat(sysinfo,math," co-processor. ",mouse,' available.',@CRLF) sysinfo=strcat(sysinfo,WinMetrics(0),'x',WinMetrics(1)," video resolution. ",WinMetrics(-1)," colors.",@CRLF) ErrorMode(@OFF) LastError() PlayMedia("Status WaveForm Ready") ErrorMode(@CANCEL) if LastError()!=1193 then sysinfo=strcat(sysinfo,"Windows multimedia extensions present.",@CRLF) math=NetInfo(0) if math=="MULTINET" then math=strcat(math,"/",NetInfo(1)) sysinfo=strcat(sysinfo,math," Network installed.",@CRLF) switch wcx case 0 bug=WinResources(0)/1024 ; Compute memory avail math=strlen(bug) if math>3 then bug=strcat(strsub(bug,1,math-3),',',strsub(bug,math-2,3)) sysinfo=strcat(sysinfo,@CRLF,bug," KB Free Memory",@CRLF) sysinfo=strcat(sysinfo,WinResources(2),"%% System Resources Free (",WinResources(3),"%% GDI, ",WinResources(4),"%% User)",@CRLF) break case wcx bug=WinResources(11)/1024 ; Get Physical memory avail sysinfo=strcat(sysinfo,@CRLF,bug," KB Physical Memory",@CRLF) bug=(WinResources(14)/1024)+bug ; Get Virtual memory + Physical avail sysinfo=strcat(sysinfo,bug," KB Total Memory",@CRLF) end switch sysinfo=strcat(sysinfo,"Console ",DosVersion(1),'.',DosVersion(0)," using ",environment("COMSPEC"),@CRLF) disks=DiskScan(1) disks=strreplace(disks,@tab," ") if disks!="" then sysinfo=strcat(sysinfo,"Floppies ",disks,@CRLF) disks=DiskScan(2) disks=strreplace(disks,@tab," ") if disks!="" then sysinfo=strcat(sysinfo,"Hard Disks ",disks,@CRLF) disks=DiskScan(4) disks=strreplace(disks,@tab," ") if disks!="" then sysinfo=strcat(sysinfo,"Network Disks ",disks,@CRLF) sysinfo=strcat(sysinfo,"Windows Directory ",DirWindows(0),@CRLF) sysinfo=strcat(sysinfo,"System Directory ",DirWindows(1),@CRLF) sysinfo=strcat(sysinfo,@CRLF,"WIL Interpreter Ver ",VersionDll()) ver=Version() Message("WinBatch %ver% SysInfo",Sysinfo) return :vers a=Version() b=VersionDll() d1=DosVersion(@major) d2=DosVersion(@minor) w1=WinVersion(@major) w2=WinVersion(@minor) c="Console " if w1<4 && w2<49 then c="Dos " line=strcat("WinBatch ",@tab,a,@crlf) line=strcat(line,"DllVer ",@tab,@tab,b,@crlf) line=strcat(line,c,@tab,@tab,d1,".",d2,@crlf) line=strcat(line,"Windows ",@tab,@tab,w1,".",w2,@crlf) if w1==3 && w2==1 line=strcat(line,@crlf,"Note: Ver 3.1 reported by Windows.",@crlf,"May be 3.11 instead") endif Message("Version Information",line) About() drop(a,b,c,d1,d2,w1,w2,line) return :wbhelp helpfile1="winbatch.hlp" helpfile=FileLocate(helpfile1) if helpfile=="" wbdir=DirHome() wbdir=strsub(wbdir,1,strlen(wbdir)-1) wbdir=FilePath(wbdir) helpfile3=strcat(wbdir,helpfile1) helpfile=FileLocate(helpfile3) if helpfile=="" Message("Sorry. Cannot locate help files",strcat(helpfile2,@crlf,"or",@crlf,helpfile1)) exit endif endif WinHelp(helpfile,"Contents","") return :initial zym=strcat(2,"cha") ral="st1" pqr="6:16:9:6:0:2:11:16:2:1" afc="" qwx="num%zym%r" for xx=1 to 10 afc=strcat(afc,%qwx%(99+ItemExtract(xx,pqr,":"))) next if %afc%() then li%ral%="About WinBatch" return :wilhelp :tutorial helpfile1="Windows Interface Language.hlp" helpfile=FileLocate(helpfile1) if helpfile=="" helpfile2="wil.hlp" helpfile=FileLocate(helpfile2) if helpfile=="" wbdir=DirHome() wbdir=strsub(wbdir,1,strlen(wbdir)-1) wbdir=FilePath(wbdir) helpfile3=strcat(wbdir,helpfile1) helpfile=FileLocate(helpfile3) if helpfile=="" helpfile3=strcat(wbdir,helpfile2) helpfile=FileLocate(helpfile3) if helpfile=="" Message("Sorry. Cannot locate help files",strcat(helpfile2,@crlf,"or",@crlf,helpfile1)) exit endif endif endif endif if action=="wilhelp" then WinHelp(helpfile,"CONTENTS","") else WinHelp(helpfile,"KEY","Tutorial") drop(helpfile1,helpfile,helpfile2,helpfile3) return :nwcalls a="nwcalls.dll" b="netware.drv" a1=FileLocate(a) if a1!="" line=strcat(a1," ",FileTimeGet(a1),@crlf) else line=strcat(a," Not Found",@crlf) endif b1=FileLocate(b) if b1!="" line=strcat(line,b1," ",FileTimeGet(b1),@crlf) else line=strcat(line,b," Not Found") endif if a1!="" a3=FileYmdHms(a1) If TimeDiffDays(a3,"1994:02:28:00:00:00")<0 line=strcat(line,@crlf,"WARNING: NWCALLS older than Feb 28, 1994") endif endif Message("NWCalls Diagnostics",line) Drop(a,b,a1,line,b1,a3) return :ctl3d if WinMetrics(-2)==1 cdll="ctl3dv2.dll" ; 16 bit else cdll="ctl3d32.dll" ; 32 bit endif a=FilePath(FileLocate(cdll)) if a=="" then a=FilePath(FileLocate(strcat(DirWindows(1),cdll))) b=FilePath(FileLocate(strcat(DirWindows(1),cdll))) a=strlower(a) b=strlower(b) if a=="" Message(cdll,"not found") else if a==b Message("Checking %cdll%","Paths to %cdll% seem OK") else if b=="" Message(cdll,strcat("Not found in",@crlf,DirWindows(1),@crlf,"Installation error")) else line=strcat(cdll," can be accessed via",@crlf,a,@crlf,"and",@crlf,b,@crlf,@crlf,b,@crlf,"should be first in PATH") Message("Path problem to Windows System Directory",line) endif endif endif drop(cdll,a,b,line) return :language DirChange(DirHome()) Message("WinBatch Language Changer","This option will change the language used on buttons in some dialog boxes and error messages.") MyDialogFormat=`WWWDLGED,5.0` MyDialogCaption=`WIL Language Selector` MyDialogX=60 MyDialogY=79 MyDialogWidth=289 MyDialogHeight=146 MyDialogNumControls=6 MyDialog01=`2,66,278,56,ITEMBOX,Choice,DEFAULT` MyDialog02=`20,22,270,DEFAULT,VARYTEXT,current,""` MyDialog03=`54,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Ok",1` MyDialog04=`148,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0` MyDialog05=`10,6,114,DEFAULT,STATICTEXT,DEFAULT,"Current Language is:"` MyDialog06=`10,46,272,DEFAULT,STATICTEXT,DEFAULT,"Select desired language"` ;Determine current language Current=inireadpvt("Main","Language","NONE","WWWBATCH.INI") if Current=="NONE" current="English" else if strlen(Current)!=3 then current="enu" current=IniReadPvt("Main","Description","Unknown",strcat(DirGet(),"WWWDLANG.",current)) endif LangFiles=strupper(FileItemize("WWWDLANG.*")) a=ItemLocate("WWWDLANG.DLL",LangFiles,@TAB) if a!=0 then LangFiles=ItemRemove(a,LangFiles,@TAB) LangFiles=ItemSort(LangFiles,@TAB) LangCount=ItemCount(LangFiles,@TAB) if LangCount==0 Message("Language","No WWWDLANG.* Language files found.%@crlf%Perhaps optional language files were not installed%@crlf%Using English") return endif LangList="" for i=1 to LangCount lfile=ItemExtract(i,LangFiles,@TAB) Lang=IniReadPvt("Main","Description","NONE",strcat(DirGet(),lfile)) if Lang=="NONE" then Lang=FileExtension (lfile) if i<LangCount then LangList=strcat(LangList,Lang,@tab) else LangList=strcat(LangList,Lang) next while 1 choice=LangList Dialog("MyDialog") if Choice=="" then return if ItemCount(Choice,@tab)>1 Display(4,"Language","You may only select one language") continue endif break endwhile a=ItemLocate(choice,LangList,@tab) lfile=ItemExtract(a,LangFiles,@TAB) ext=FileExtension(lfile) if ext=="ENU" IniDeletePvt("Main","Language","WWWBATCH.INI") Message("English chosen as langauge","DLL Will use internal strings instead of language file") else IniWritePvt("Main","Language",ext,"WWWBATCH.INI") Message("Language","Language set to %Choice%") endif IntControl(26,0,0,0,0) ;Tell DLL to reset language strings return :mickey Message("Mouse Tracker","This selection shows current mouse co-ordinates") BoxOpen("Mouse Tracker","") WinPlace(100,700,900,900,"Mouse Tracker") while 1 ;debug(1) childwin=MouseInfo(0) parentwin=MouseInfo(1) xc=childwin xp=parentwin if childwin==parentwin then childwin="" if childwin!="" if !WinExistChild(parentwin,childwin) then childwin="" endif xy=MouseCoords("%parentwin%","%childwin%") a=MouseInfo(2) x=ItemExtract(1,xy," ") y=ItemExtract(2,xy," ") mmove=strcat('MouseMove( ',x,', ',y,', "',parentwin,'", "',childwin,'")') BoxText(strcat("MouseMove Info",@crlf,mmove,@crlf,@crlf,"Hold shift key down to exit")) TimeDelay(0.5) If IsKeyDown(@shift) then break end while BoxShut() return