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