; Menu file for wbt extension

;AMAZINGLY IMPORTANT NOTICE!!
;This file is automatically overwritten during upgrade
;or re-install of the WinBatch product.  If you make
;changes to it...SAVE YOUR BACKUPS...This file will
;be overwritten without notice.

;Updated for VISTA UAC Issues by using ShellExecute

Run with WinBatch     ; Runs the Winbatch Interpreter on this file
        f = strcat('"',CurrFilePath(),'"')
        ShellExecute("winbatch.exe",f, "",@NORMAL,"")

WinBatch Studio    ; Edit the Winbatch file
        a = FileItemPath ( "" )
        fc = ItemCount ( a , @tab )
        for j = 1 to fc
           file = ItemExtract ( j , a , @tab )
           fwquotes = strcat('"',file,'"')
           ShellExecute ( "WinBatch Studio.exe" , fwquotes, "",@NORMAL,"" )
        next
 
WinBatch Compiler  ;Run the WinBatch Compiler
        f=strcat('"',CurrFilePath(),'"')
        ShellExecute("WBCompiler.exe",f, "",@NORMAL,"")
                   
Run with WinBatch 64-bit
        f = strcat('"',CurrFilePath(),'"')
        RegOpenFlags(1) ; Tell WB to look at 32 bit registry on 64 bit systems
		  homedir64="" 
        ErrorMode(@OFF)
		  homedir64=RegQueryValue(@REGMACHINE, "SOFTWARE\Wilson WindowWare\WinBatch\CurrentSystem64")
		  ErrorMode(@CANCEL)
        RegOpenFlags(0) ; Tell WB to resume default registry operations
		  if homedir64==0 then homdir64=""
        wb64=Strcat(homedir64,"winbatch.exe")
		  if homedir64!="" && FileExist(wb64)
      	  ShellExecute(wb64, f , "", @NORMAL, "")
		  elseif WinMetrics(-7)==2
           Message("FileMenu Error","WinBatch 64-bit is not installed")
		  else
           Message("FileMenu Error","WinBatch 64-bit is only available on 64-bit systems")			
		  endif

WinBatch Compiler 64-bit
        f=strcat('"',CurrFilePath(),'"')
        RegOpenFlags(1) ; Tell WB to look at 32 bit registry on 64 bit systems
		  homedir64="" 
        ErrorMode(@OFF)
		  homedir64=RegQueryValue(@REGMACHINE, "SOFTWARE\Wilson WindowWare\WinBatch\CurrentSystem64")
		  ErrorMode(@CANCEL)
        RegOpenFlags(0) ; Tell WB to resume default registry operations
		  if homedir64==0 then homdir64=""
        wbc64=Strcat(homedir64,"wbcompiler.exe")
		  if homedir64!="" && FileExist(wbc64)
      	  ShellExecute(wbc64, f , "", @NORMAL, "")
		  elseif WinMetrics(-7)==2
           Message("FileMenu Error","WinBatch Compiler 64-bit is not installed")
		  else
           Message("FileMenu Error","WinBatch Compiler 64-bit is only available on 64-bit systems")			
		  endif
  
