home *** CD-ROM | disk | FTP | other *** search
/ PC World 1999 February / PCWorld_1999-02_cd.bin / software / Zkuste / WinBat98 / DEFAULT.WB_ < prev    next >
Text File  |  1997-06-30  |  16KB  |  461 lines

  1. ; DEFAULT.WBT
  2. ; Whne WinBatch is executed without any parameters, it attempts to locate
  3. ; and execute this DEFAULT.WBT file.  
  4.  
  5. IntControl(29, @TAB, 0, 0, 0)     ; standardize on tab delimters
  6.  
  7. list1="WinBatch AboutBox"
  8. action1="vers"
  9.  
  10. list2="System Information"
  11. action2="sysinfo"
  12.  
  13. list3="WinBatch Help File"
  14. action3="wbhelp"
  15.  
  16. list4="WIL Help File"
  17. action4="wilhelp"
  18.  
  19. list5="Tutorial"
  20. action5="tutorial"
  21.  
  22. list6="Language Changer"
  23. action6="language"
  24.  
  25. list7="NWCalls Diagnostics"
  26. action7="nwcalls"
  27.  
  28. list8="Ctl3D Diagnostics"
  29. action8="ctl3d"
  30.  
  31. list9="Remove license Info"
  32. action9="remlic"
  33.  
  34. list10="Uninstall WinBatch"
  35. action10="remove"
  36.  
  37. list11="Track Mouse co-ordinates"
  38. action11="mickey"
  39.  
  40. list12="Determine Owning EXE file"
  41. action12="owner"
  42.  
  43. list13="Run a WBT file"
  44. action13="runwbt"
  45.  
  46. ;- - -
  47. gosub initial
  48. query=list1
  49.  
  50. for xx=2 to 100
  51.     if IsDefined(list%xx%)
  52.         query=strcat(query,@tab,list%xx%)
  53.     else
  54.         break
  55.     endif
  56. next
  57.  
  58. while 1
  59.    ask987=AskItemList("Running Default.wbt : Choose an option",query,@tab,@unsorted,@single)
  60.    if ask987=="" then break
  61.    xx987=ItemLocate(ask987,query,@tab)
  62.    action=strlower(action%xx987%)
  63.  
  64.    gosub %action%
  65. endwhile
  66. exit
  67.  
  68. ;- - - - - - - - - - - - -
  69.     
  70. :remlic
  71.     a=AskYesNo("WinBatch Unlicensing","Pressing YES will remove WinBatch and Compiler license information from your system.%@crlf%Do you wish to continue?")
  72.     if a==@no then return
  73.     if WinMetrics(-2)==2   ; 32 bit platform
  74.         ErrorMode(@off)
  75.         regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB32I[info]")
  76.         regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC32I[info]")
  77.         regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB32I[info2]")
  78.         regdelvalue(@regmachine,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC32I[info2]")
  79.         ErrorMode(@cancel)
  80.     endif
  81.     a=IniReadPvt("WB16I","info","XXX","WWW-PROD.INI")
  82.     if a!="XXX" 
  83.        IniDeletePvt("WB16I","info","WWW-PROD.INI")
  84.        IniDeletePvt("WB16I","info2","WWW-PROD.INI")
  85.     endif
  86.     a=IniReadPvt("WBC16I","info","XXX","WWW-PROD.INI")
  87.     if a!="XXX"
  88.        IniDeletePvt("WBC16I","info","WWW-PROD.INI")
  89.        IniDeletePvt("WBC16I","info2","WWW-PROD.INI")
  90.     endif
  91.     return
  92.     
  93. :owner
  94.         a1="This option is to determine the application that has "
  95.         a2="spawned a particular window in question."
  96.         a3="Sometimes, some programs are actually loader programs"
  97.         a4="for the 'real' application. "
  98.         a5="The WinBatch AppWaitClose/AppExist functions need to know"
  99.         a6="actual exe names.  This script will display the"
  100.         a7="Actual EXE  name."
  101.         
  102.         text=strcat(a1,@crlf,a2,@crlf,a3,@crlf,a4,@crlf,a5,@crlf,a6,@crlf,a7)
  103.         Message("EXE Finder",text)
  104.         text="Put mouse over Window to determine exe file.%@crlf%Hold Shift Key down to quit the EXE finder."
  105.         BoxOpen("EXE FILE FINDER","")
  106.         While @TRUE     ; Loop forever and ever
  107.              if IsKeyDown(@SHIFT) then break
  108.              WinActivate("")
  109.              a=MouseInfo(1)
  110.              exe=WinExeName(a)
  111.              exe2=strcat(FileRoot(exe),".",FileExtension(exe))
  112.              BoxText(strcat(text,@crlf,@crlf,"EXE = ",exe2))
  113.              TimeDelay(0.5)
  114.         endwhile
  115.         BoxTitle("WinBatch")
  116.         BoxText("WinBatch Processing")
  117.         BoxShut()
  118.         return    
  119.     
  120. :remove
  121.     a=DirHome()
  122.     b=FileLocate(strcat(a,"uninstal.exe"))
  123.     if b==""
  124.         Message("Error",strcat("Uninatall program (uninstal.exe) not found at",@crlf,b)
  125.         return
  126.     endif
  127.     Run(b,"")
  128.     exit
  129.     
  130. :runwbt
  131.    while 1
  132.       xyzzywbtfile=strlower(AskFileName("WinBatch","","WinBatch (*.WBT)|*.WBT|","*.WBT",1))
  133.       if xyzzywbtfile!=""
  134.          if strcat(FileRoot(xyzzywbtfile),".",FileExtension(xyzzywbtfile))=="default.wbt"
  135.             Message("Already running default.wbt","Try looking in the samples directory for sample wbt scripts to run.")
  136.             continue
  137.          else
  138.             if strindex(xyzzywbtfile," ",0,@fwdscan)!=0
  139.                xyzzywbtfile=strcat('"',xyzzywbtfile,'"')
  140.             endif
  141.             run(WinExeName(""),xyzzywbtfile)
  142.             exit
  143.          endif
  144.       return
  145.    endwhile
  146.     
  147.  :sysinfo
  148.  
  149.         wintype="retail"
  150.         if WinMetrics(22) then wintype="debug"
  151.         
  152.         wcx=WinMetrics(-3)
  153.         math="Math"
  154.         switch wcx
  155.            case 0   ; Win16
  156.                 wc=WinConfig()
  157.                 if !(wc&1) then mode="Real"
  158.                 if wc&16 then mode="Standard"
  159.                 if wc&32 then mode="Enhanced"
  160.                 
  161.                 if wc&64 then cpu=8086
  162.                 if wc&128 then cpu=80186
  163.                 if wc&2 then cpu=286
  164.                 if wc&4 then cpu=386
  165.                 if wc&8 then cpu=486
  166.                 mode = strcat(mode,' ',wintype,' Windows ')
  167.                 if !(wc&1024)  then math="No math"
  168.                 break
  169.           case 1 ; Win32 Intel
  170.                mode="Intel 32-bit %wintype% Windows "
  171.                cpu= ItemExtract(6,WinSysInfo(),@tab)
  172.                break
  173.           case 2 ; Dec Alpha
  174.                mode="DEC Alpha %wintype% Windows NT "
  175.                cpu= ItemExtract(6,WinSysInfo(),@tab)
  176.                break
  177.           case 3 ; MIPS
  178.                mode="MIPS %wintype% Windows NT "
  179.                cpu= ItemExtract(6,WinSysInfo(),@tab)
  180.                break
  181.           case 4 ; PowerPC 
  182.                mode="PowerPC %wintype% Windows NT "
  183.                cpu= ItemExtract(6,WinSysInfo(),@tab)
  184.                break
  185.           case wcx
  186.                cpu="Unknown CPU"
  187.                mode="Unknown %wintype% Windows  "
  188.         endswitch
  189.         Sysinfo=strcat(cpu,' ',mode,WinVersion(1),'.',WinVersion(0),@CRLF)
  190.         mouse="No Mouse"
  191.         if WinMetrics(19) then mouse="Mouse"
  192.         Sysinfo=strcat(sysinfo,math," co-processor.   ",mouse,' available.',@CRLF)
  193.         sysinfo=strcat(sysinfo,WinMetrics(0),'x',WinMetrics(1)," video resolution.  ",WinMetrics(-1),"  colors.",@CRLF)
  194.         ErrorMode(@OFF)
  195.         LastError()
  196.         PlayMedia("Status WaveForm Ready")
  197.         ErrorMode(@CANCEL)
  198.         if LastError()!=1193 then sysinfo=strcat(sysinfo,"Windows multimedia extensions present.",@CRLF)
  199.         math=NetInfo(0)
  200.         if math=="MULTINET" then math=strcat(math,"/",NetInfo(1))
  201.         sysinfo=strcat(sysinfo,math," Network installed.",@CRLF) 
  202.         switch wcx
  203.            case 0
  204.                bug=WinResources(0)/1024   ; Compute memory avail
  205.                math=strlen(bug)
  206.                if math>3 then bug=strcat(strsub(bug,1,math-3),',',strsub(bug,math-2,3))
  207.                sysinfo=strcat(sysinfo,@CRLF,bug," KB Free Memory",@CRLF)
  208.                sysinfo=strcat(sysinfo,WinResources(2),"%% System Resources Free (",WinResources(3),"%% GDI, ",WinResources(4),"%% User)",@CRLF)
  209.               break
  210.            case wcx
  211.               bug=WinResources(11)/1024   ; Get Physical memory avail
  212.               sysinfo=strcat(sysinfo,@CRLF,bug," KB Physical Memory",@CRLF)
  213.               bug=(WinResources(14)/1024)+bug   ; Get Virtual memory + Physical avail
  214.               sysinfo=strcat(sysinfo,bug," KB Total Memory",@CRLF)
  215.         end switch
  216.         sysinfo=strcat(sysinfo,"Console ",DosVersion(1),'.',DosVersion(0),"  using ",environment("COMSPEC"),@CRLF)
  217.         disks=DiskScan(1)
  218.         disks=strreplace(disks,@tab," ")
  219.         if disks!="" then sysinfo=strcat(sysinfo,"Floppies ",disks,@CRLF)
  220.         disks=DiskScan(2)
  221.         disks=strreplace(disks,@tab," ")
  222.         if disks!="" then sysinfo=strcat(sysinfo,"Hard Disks ",disks,@CRLF)
  223.         disks=DiskScan(4)
  224.         disks=strreplace(disks,@tab," ")
  225.         if disks!="" then sysinfo=strcat(sysinfo,"Network Disks ",disks,@CRLF)
  226.         sysinfo=strcat(sysinfo,"Windows Directory ",DirWindows(0),@CRLF)
  227.         sysinfo=strcat(sysinfo,"System  Directory ",DirWindows(1),@CRLF)
  228.         sysinfo=strcat(sysinfo,@CRLF,"WIL Interpreter Ver ",VersionDll())
  229.         ver=Version()
  230.         Message("WinBatch %ver% SysInfo",Sysinfo)
  231.  
  232.     return
  233.     
  234. :vers
  235.     a=Version()
  236.     b=VersionDll()
  237.     d1=DosVersion(@major)
  238.     d2=DosVersion(@minor)
  239.     w1=WinVersion(@major)
  240.     w2=WinVersion(@minor)
  241.     c="Console "
  242.     if w1<4 && w2<49 then c="Dos "
  243.     line=strcat("WinBatch    ",@tab,a,@crlf)
  244.     line=strcat(line,"DllVer ",@tab,@tab,b,@crlf)
  245.     line=strcat(line,c,@tab,@tab,d1,".",d2,@crlf)
  246.     line=strcat(line,"Windows ",@tab,@tab,w1,".",w2,@crlf)
  247.     if w1==3 && w2==1
  248.        line=strcat(line,@crlf,"Note: Ver 3.1 reported by Windows.",@crlf,"May be 3.11 instead")
  249.     endif
  250.     Message("Version Information",line)
  251.     About()
  252.     drop(a,b,c,d1,d2,w1,w2,line)
  253.     return
  254.     
  255. :wbhelp
  256.         
  257.         helpfile1="winbatch.hlp"
  258.         helpfile=FileLocate(helpfile1)
  259.         if helpfile==""
  260.             wbdir=DirHome()
  261.             wbdir=strsub(wbdir,1,strlen(wbdir)-1)
  262.             wbdir=FilePath(wbdir)
  263.             helpfile3=strcat(wbdir,helpfile1)
  264.             helpfile=FileLocate(helpfile3)
  265.             if helpfile==""
  266.                 Message("Sorry.  Cannot locate help files",strcat(helpfile2,@crlf,"or",@crlf,helpfile1))
  267.                 exit
  268.             endif
  269.         endif
  270.         WinHelp(helpfile,"Contents","")
  271.     return
  272.     
  273. :initial
  274.         zym=strcat(2,"cha")
  275.         ral="st1"
  276.         pqr="6:16:9:6:0:2:11:16:2:1"
  277.         afc=""
  278.         qwx="num%zym%r"
  279.         for xx=1 to 10
  280.             afc=strcat(afc,%qwx%(99+ItemExtract(xx,pqr,":")))
  281.         next   
  282.         if %afc%() then li%ral%="About WinBatch"
  283.     return  
  284.       
  285. :wilhelp
  286. :tutorial
  287.         helpfile1="Windows Interface Language.hlp"
  288.         helpfile=FileLocate(helpfile1)
  289.         if helpfile==""
  290.            helpfile2="wil.hlp"
  291.            helpfile=FileLocate(helpfile2)
  292.            if helpfile==""
  293.                wbdir=DirHome()
  294.                wbdir=strsub(wbdir,1,strlen(wbdir)-1)
  295.                wbdir=FilePath(wbdir)
  296.                helpfile3=strcat(wbdir,helpfile1)
  297.                helpfile=FileLocate(helpfile3)
  298.                if helpfile==""
  299.                   helpfile3=strcat(wbdir,helpfile2)
  300.                   helpfile=FileLocate(helpfile3)
  301.                   if helpfile==""
  302.                       Message("Sorry.  Cannot locate help files",strcat(helpfile2,@crlf,"or",@crlf,helpfile1))
  303.                       exit
  304.                   endif
  305.                endif
  306.            endif
  307.         endif
  308.         if action=="wilhelp" then WinHelp(helpfile,"CONTENTS","")
  309.                            else WinHelp(helpfile,"KEY","Tutorial")
  310.         drop(helpfile1,helpfile,helpfile2,helpfile3)
  311.     return
  312.     
  313.  
  314.  
  315. :nwcalls
  316.     a="nwcalls.dll"
  317.     b="netware.drv"
  318.     a1=FileLocate(a)
  319.     if a1!=""
  320.          line=strcat(a1," ",FileTimeGet(a1),@crlf)
  321.     else
  322.           line=strcat(a," Not Found",@crlf)
  323.     endif
  324.     b1=FileLocate(b)
  325.     if b1!=""
  326.          line=strcat(line,b1," ",FileTimeGet(b1),@crlf)
  327.     else
  328.          line=strcat(line,b," Not Found")
  329.     endif
  330.     if a1!=""
  331.        a3=FileYmdHms(a1)
  332.        If TimeDiffDays(a3,"1994:02:28:00:00:00")<0
  333.            line=strcat(line,@crlf,"WARNING: NWCALLS older than Feb 28, 1994)
  334.        endif
  335.     endif
  336.     Message("NWCalls Diagnostics",line)
  337.     Drop(a,b,a1,line,b1,a3)
  338.     return
  339.     
  340. :ctl3d
  341.     if WinMetrics(-2)==1
  342.        cdll="ctl3dv2.dll"   ; 16 bit
  343.     else
  344.        cdll="ctl3d32.dll"   ; 32 bit
  345.     endif
  346.     a=FilePath(FileLocate(cdll))
  347.     if a=="" then a=FilePath(FileLocate(strcat(DirWindows(1),cdll)))
  348.     b=FilePath(FileLocate(strcat(DirWindows(1),cdll)))
  349.     a=strlower(a)
  350.     b=strlower(b)
  351.     if a==""
  352.         Message(cdll,"not found")
  353.     else
  354.        if a==b
  355.           Message("Checking %cdll%","Paths to %cdll% seem OK")
  356.        else
  357.           if b==""
  358.              Message(cdll,strcat("Not found in",@crlf,DirWindows(1),@crlf,"Installation error")
  359.           else
  360.              line=strcat(cdll," can be accessed via",@crlf,a,@crlf,"and",@crlf,b,@crlf,@crlf,b,@crlf,"should be first in PATH")
  361.              Message("Path problem to Windows System Directory",line)
  362.           endif
  363.        endif
  364.     endif
  365.     drop(cdll,a,b,line)
  366.     return
  367.    
  368. :language
  369.         DirChange(DirHome())
  370.         Message("WinBatch Language Changer","This option will change the language used on buttons in some dialog boxes and error messages.")
  371.         MyDialogFormat=`WWWDLGED,5.0`
  372.         
  373.         MyDialogCaption=`WIL Language Selector`
  374.         MyDialogX=60
  375.         MyDialogY=79
  376.         MyDialogWidth=289
  377.         MyDialogHeight=146
  378.         MyDialogNumControls=6
  379.         
  380.         MyDialog01=`2,66,278,56,ITEMBOX,Choice,DEFAULT`
  381.         MyDialog02=`20,22,270,DEFAULT,VARYTEXT,current,""`
  382.         MyDialog03=`54,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Ok",1`
  383.         MyDialog04=`148,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0`
  384.         MyDialog05=`10,6,114,DEFAULT,STATICTEXT,DEFAULT,"Current Language is:"`
  385.         MyDialog06=`10,46,272,DEFAULT,STATICTEXT,DEFAULT,"Select desired language"`
  386.         
  387.         
  388.         ;Determine current language
  389.         
  390.         Current=inireadpvt("Main","Language","NONE","WWWBATCH.INI")
  391.         if Current=="NONE"
  392.            current="English"
  393.         else
  394.            if strlen(Current)!=3 then current="enu"
  395.            current=IniReadPvt("Main","Description","Unknown",strcat(DirGet(),"WWWDLANG.",current))
  396.         endif   
  397.         
  398.         LangFiles=strupper(FileItemize("WWWDLANG.*"))
  399.         a=ItemLocate("WWWDLANG.DLL",LangFiles,@TAB)
  400.         if a!=0 then LangFiles=ItemRemove(a,LangFiles,@TAB)
  401.         LangFiles=ItemSort(LangFiles,@TAB)
  402.         
  403.         LangCount=ItemCount(LangFiles,@TAB)
  404.         if LangCount==0
  405.            Message("Language","No WWWDLANG.* Language files found.%@crlf%Perhaps optional language files were not installed%@crlf%Using English")
  406.            return
  407.         endif
  408.         
  409.         LangList=""
  410.         for i=1 to LangCount
  411.            lfile=ItemExtract(i,LangFiles,@TAB)
  412.            Lang=IniReadPvt("Main","Description","NONE",strcat(DirGet(),lfile))
  413.            if Lang=="NONE" then Lang=FileExtension (lfile)
  414.            if i<LangCount then LangList=strcat(LangList,Lang,@tab)
  415.            else LangList=strcat(LangList,Lang)
  416.         next 
  417.         
  418.         
  419.         while 1
  420.            choice=LangList
  421.            Dialog("MyDialog")
  422.           
  423.            if Choice=="" then return
  424.            if ItemCount(Choice,@tab)>1 
  425.               Display(4,"Language","You may only select one language")
  426.               continue
  427.            endif
  428.            break
  429.         endwhile
  430.         
  431.         a=ItemLocate(choice,LangList,@tab)
  432.         lfile=ItemExtract(a,LangFiles,@TAB)
  433.         ext=FileExtension(lfile)
  434.         
  435.         if ext=="ENU"
  436.            IniDeletePvt("Main","Language","WWWBATCH.INI")
  437.            Message("English chosen as langauge","DLL Will use internal strings instead of language file")
  438.         else
  439.            IniWritePvt("Main","Language",ext,"WWWBATCH.INI")
  440.            Message("Language","Language set to %Choice%")
  441.         endif
  442.         
  443.         IntControl(26,0,0,0,0)   ;Tell DLL to reset language strings
  444.         
  445.         return
  446.  
  447.  
  448. :mickey
  449.         Message("Mouse Tracker","This selection shows current mouse co-ordinates")
  450.         BoxOpen("Mouse Tracker","")
  451.         while 1
  452.            a=MouseInfo(2)
  453.            BoxText(strcat("Mouse co-ordinates = ",a,@crlf,@crlf,"Hold shift key down to exit"))
  454.            TimeDelay(0.5)
  455.            If IsKeyDown(@shift) then break
  456.         end while
  457.         return
  458.  
  459.  
  460.  
  461.