#DefineFunction DirAuxFile()
	if WinMetrics(-2) == 3
		strPathExe = ""
		ErrorMode(@Off)
		strPathExe = RegQueryValue(@REGMACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinBatch.exe", 32)
		ErrorMode(@CANCEL)
		return FilePath(strPathExe)
	else
		return DirHome()
	endif
#EndFunction

#DefineFunction MyIniDir()
	inidir = ShortCutDir("AppData",0,1):"WinBatch\Settings\"
	Return(inidir)
#EndFunction

#DefineFunction MyIniFile(inifragment)
	inifile = MyIniDir():inifragment
	Return(inifile)
#EndFunction

#DefineFunction wwwprodini()
	Return ShortCutDir("AppData",0,1):"WinBatch\Settings\www-prod.ini"
#EndFunction
#DefineFunction DeleteLicenseInfo(nBitness) ; 
	If WinMetrics(-2) >= 2 && (nBitness & 32)  ; 32-bit and maybe 64-bit platforms
		oldflags = RegOpenFlags(32) ; 32 bit view
		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\WB32I[infoCP]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC32I[infoCP]")
	
		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]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB34I[infoCP]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC34I[infoCP]")
	
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB44I[info]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC44I[info]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB44I[info2]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC44I[info2]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB44I[infoCP]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC44I[infoCP]")
	
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB32I[info]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC32I[info]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB32I[info2]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC32I[info2]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB32I[infoCP]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC32I[infoCP]")
	
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB34I[info]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC34I[info]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB34I[info2]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC34I[info2]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB34I[infoCP]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC34I[infoCP]")
	
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB44I[info]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC44I[info]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB44I[info2]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC44I[info2]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB44I[infoCP]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC44I[infoCP]")
		ErrorMode(@CANCEL)
		RegOpenFlags(oldflags) ; restore previous view
	EndIf
	If (WinMetrics(-2) == 3 || WinMetrics(-7) == 2) && (nBitness & 64); 64-bit platform only
		oldflags = RegOpenFlags(64) ; 64 bit view
		ErrorMode(@OFF)	
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB64I[info]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC64I[info]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB64I[info2]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC64I[info2]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB64I[infoCP]")
		RegDelValue(@REGMACHINE,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC64I[infoCP]")
		
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB64I[info]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC64I[info]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB64I[info2]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC64I[info2]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WB64I[infoCP]")
		RegDelValue(@REGCURRENT,"SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WBC64I[infoCP]")
		ErrorMode(@CANCEL)
		RegOpenFlags(oldflags) ; restore previous view
	EndIf

	a = IniReadPvt("WB16I","info","XXX",wwwprodini())
	If a != "XXX"
		IniDeletePvt("WB16I","info",wwwprodini())
		IniDeletePvt("WB16I","info2",wwwprodini())
	EndIf
	a = IniReadPvt("WBC16I","info","XXX",wwwprodini())
	If a != "XXX"
		IniDeletePvt("WBC16I","info",wwwprodini())
		IniDeletePvt("WBC16I","info2",wwwprodini())
	EndIf
	inifile = StrCat(DirHome(),"license.ini")
	If FileExist(inifile)
		IniDeletePvt("WB32I",@WHOLESECTION,inifile)
		IniDeletePvt("WB32I",@WHOLESECTION,inifile)
		IniDeletePvt("WB34I",@WHOLESECTION,inifile)
		IniDeletePvt("WBC34I",@WHOLESECTION,inifile)
		IniWritePvt("","","",inifile)
		TimeDelay(5)
		FileDelete(inifile)
	EndIf
	Return
#EndFunction

#DefineFunction IsExpired()
	;***************************************************************************
	;** This subroutine can check if maintenance has expired
	;** If expired, offer to take them to website commerce server
	;** If about to expire, (within a month) notify them, offer to take them to website commerce server
	;***************************************************************************
	wbcgoodthru = IntControl(86,"WBC44I",0,0,0)
	wbgoodthru = IntControl(86,"WB44I",0,0,0)
	maintenance_info = ""
	retcode = 0
	
	If !IsNumber(wbcgoodthru) && wbcgoodthru != ""
		package = "WinBatch+Compiler"
		retcode = CheckDate(wbcgoodthru)
	Else ;only check WinBatch, if no Compiler found
		If !IsNumber(wbgoodthru) && wbgoodthru != ""
			package = "WinBatch"
			retcode = CheckDate(wbgoodthru)
		EndIf
	EndIf
	
	GoSub Notification
	
	If maintenance_info == "" Then Return(0)
	
	title = "Product Update Info"
	text1 = "When you purchased a new copy of one of our products, your purchase price included one-year of free updates."
	text1 = StrCat(text1,"During the year after purchase you may download and use any new versions of that product released, free of charge.")
	text2 = "At this time you have the option to purchase a new license for an additional year."
	text3 = "If you choose not to purchase a new license, you will be able to continue to use this version "
	text3 = StrCat(text3,"but you will not be licensed to use future versions of the product.")
	text4 = "Please select 'Renew Now', if you'd like to visit our website, and obtain a new license."
	
	SubscriptionFormat = `WWWDLGED,6.1`
	
	SubscriptionCaption = `License Notification`
	SubscriptionX = -01
	SubscriptionY = -01
	SubscriptionWidth = 350
	SubscriptionHeight = 158
	SubscriptionNumControls = 010
	SubscriptionProcedure = `DEFAULT`
	SubscriptionFont = `DEFAULT`
	SubscriptionTextColor = `0|0|0`
	SubscriptionBackground = `DEFAULT,DEFAULT`
	SubscriptionConfig = 0
	
	Subscription001 = `079,006,262,135,GROUPBOX,DEFAULT,"",DEFAULT,94,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Subscription002 = `007,007,064,086,PICTURE,DEFAULT,"Howland",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,"WBPrgn.bmp"`
	Subscription003 = `082,017,256,031,VARYTEXT,TEXT1,DEFAULT,DEFAULT,7,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Subscription004 = `082,041,256,031,VARYTEXT,TEXT2,DEFAULT,DEFAULT,8,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Subscription005 = `082,057,256,031,VARYTEXT,TEXT3,DEFAULT,DEFAULT,9,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Subscription006 = `082,081,256,031,VARYTEXT,TEXT4,DEFAULT,DEFAULT,9,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Subscription007 = `082,097,256,031,VARYTEXT,maintenance_info,DEFAULT,DEFAULT,10,DEFAULT,DEFAULT,"128|0|128",DEFAULT`
	Subscription008 = `113,127,079,011,PUSHBUTTON,DEFAULT,"Renew Now",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Subscription009 = `215,127,080,011,PUSHBUTTON,DEFAULT,"Renew Later",2,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Subscription010 = `242,143,104,011,CHECKBOX,NoShow,"Don't show this reminder again",1,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	
	ButtonPushed = Dialog("Subscription")
	IniWritePvt("RenewCheck",Version(),NoShow,wwwprodini())
	
	
	If ButtonPushed == 1
		url = "http://commerce.winbatch.com/webcgi/webbatch.exe?ilcpurchase/ilcshop.web"
		ShellExecute(url,"","",@NORMAL,"")
	EndIf
	Return(0)
	Exit
	
	:Notification
	Switch retcode
	Case 0 ;Within maintenance period
		;Do nothing
		status = "Within free update period"
		Break
	Case 1 ;Expired
		status = "Free Updates Expired"
		Break
	Case 2 ;About to expire, (within a month)
		status = "Free updates will expire within about one month"
		Break
	EndSwitch
	If retcode != 0
		maintenance_info = StrCat(maintenance_info,@CRLF,package," status: ",status)
	EndIf
	Return
#EndFunction
	
#DefineFunction CheckDate(goodthru); in format MM/YYYY
	;***************************************************************************
	;** This subroutine can check if maintenance has expired
	;** 0 - Within maintenance period
	;** 1 - Expired
	;** 2 - About to expire, (within a month)
	;***************************************************************************
	today = TimeYmdHms()
	goodthru_month = ItemExtract(1,goodthru,"/")
	goodthru_year = ItemExtract(2,goodthru,"/")
	goodthru = StrCat(goodthru_year,":",goodthru_month,":01:00:00:00")
	;add a month because the license is good thru the entire month
	goodthru = TimeAdd(goodthru,"0000:01:00:00:00:00")
	monthtilexpire = TimeSubtract(goodthru,"0000:01:00:00:00:00")
	If today >= monthtilexpire && today <= goodthru ; About to expire
		Return(2)
	EndIf
	If today >= goodthru ; Expired
		Return(1)
	EndIf
	If goodthru <= monthtilexpire ; Within maintenance period
		Return(0)
	EndIf
#EndFunction

#DefineFunction MainProc(MyDialogHandle,MyDialogMessage,MyDialogControlID,param4,param5)

	; Define the handy constants
	MSG_InitDialog = 0
	MSG_ButtonPressed = 2
	DC_Editbox = 028
	
	
	
	Switch MyDialogMessage
	
	Case MSG_InitDialog   ; Init_Dialog
		; Enable buttonclicked messages
		DialogProcOptions(MyDialogHandle,MSG_ButtonPressed,@TRUE)
	
		;Initialize blank edit box
		DialogControlSet(MyDialogHandle,DC_Editbox,3,"")
		Break
	
	Case MSG_ButtonPressed
	
		Switch MyDialogControlID
	
		Case 010; License Info Button
			;if WinMetrics(-2) == 3 ; 64-bit?
			;	strWbKey  = "WB64I"
			;	strWbcKey = "WBC64I"
			;else  ; 32-bit
				strWbKey  = "WB44I"
				strWbcKey = "WBC44I"
			;endif
			wbgoodthru = IntControl(86,strWbKey,0,0,0)
			wbcgoodthru = IntControl(86,strWbcKey,0,0,0)
			maintenance_info = ""
			If !IsNumber(wbcgoodthru) Then maintenance_info = StrCat(maintenance_info,"WinBatch+Compiler",@TAB,wbcgoodthru,@CRLF)
			Else If !IsNumber(wbgoodthru) Then maintenance_info = StrCat(maintenance_info,"WinBatch       ",@TAB,wbgoodthru,@CRLF)
			a = Version()
			b = VersionDLL()
			d1 = DosVersion(@MAJOR)
			d2 = DosVersion(@MINOR)
			dosver = StrCat(d1,".",d2)
			w1 = WinVersion(@MAJOR)
			w2 = WinVersion(@MINOR)
			winver = StrCat(w1,".",w2)
	
			VersionInfoFormat = `WWWDLGED,6.1`
	
			VersionInfoCaption = `License & Version Information`
			VersionInfoX = -01
			VersionInfoY = -01
			VersionInfoWidth = 218
			VersionInfoHeight = 152
			VersionInfoNumControls = 015
			VersionInfoProcedure = `DEFAULT`
			VersionInfoFont = `Microsoft Sans Serif|5325|70|34`
			VersionInfoTextColor = `0|0|0`
			VersionInfoBackground = `DEFAULT,DEFAULT`
			VersionInfoConfig = 0
	
			VersionInfo001 = `047,129,036,014,PUSHBUTTON,DEFAULT,"OK",1,1,32,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo002 = `129,129,036,014,PUSHBUTTON,DEFAULT,"Cancel",0,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo003 = `013,095,084,012,PUSHBUTTON,DEFAULT,"Enter New License Numbers",2,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo004 = `113,093,084,012,PUSHBUTTON,DEFAULT,"About Winbatch",4,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo005 = `071,007,032,008,VARYTEXT,a,DEFAULT,DEFAULT,7,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo006 = `071,019,032,010,VARYTEXT,b,DEFAULT,DEFAULT,9,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo007 = `171,007,032,010,VARYTEXT,dosver,DEFAULT,DEFAULT,11,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo008 = `171,019,030,010,VARYTEXT,winver,DEFAULT,DEFAULT,13,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo009 = `013,007,052,008,STATICTEXT,DEFAULT,"WinBatch",DEFAULT,6,0,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo010 = `013,019,052,010,STATICTEXT,DEFAULT,"DLL Version",DEFAULT,8,0,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo011 = `113,007,052,010,STATICTEXT,DEFAULT,"Console Version",DEFAULT,10,0,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo012 = `113,021,052,010,STATICTEXT,DEFAULT,"Windows Version",DEFAULT,12,0,DEFAULT,DEFAULT,DEFAULT`
			VersionInfo013 = `013,035,082,010,STATICTEXT,DEFAULT,"Maintenance Good Through:",DEFAULT,14,DEFAULT,"Microsoft Sans Serif|5325|70|34","0|0|0",DEFAULT`
			VersionInfo014 = `037,049,128,034,MULTILINEBOX,maintenance_info,DEFAULT,DEFAULT,15,8,"Microsoft Sans Serif|5325|70|34","0|0|0",DEFAULT`
			VersionInfo015 = `013,111,084,012,PUSHBUTTON,DEFAULT,"Remove License Numbers",3,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	
			ButtonPushed = Dialog("VersionInfo")
	
	
	
			Switch ButtonPushed
			Case 0 ;Cancel
				Break
	
			Case 1 ;OK
				Break
	
			Case 2 ;Enter New License Numbers
				;First remove existing license number
 			    
				DeleteLicenseInfo(32|64)
				ShellExecute(WinExename(""),StrCat('"',IntControl(1004,0,0,0,0),'"'),"",@NORMAL,"")
				Exit
	
			Case 3 ;Remove License Numbers
				;Remove license info
				a = AskYesNo("WinBatch Unlicensing","Pressing YES will remove WinBatch license information from your system.%@crlf%Do you wish to continue?")
				If a == @NO Then Break
				DeleteLicenseInfo(32|64)
				Break
	
			Case 4 ;About WinBatch
				About()
				Break
			EndSwitch
			Return -2
			Break
	
		Case 011; Exit Button
			Return -1
			Break
	
		Case 014; Getting Started Button
			url = "http://www.winbatch.com/quickstart.html"
			ShellExecute(url,"","",@NORMAL,"")
			Return -2
			Break
	
	
		Case 016; Run .WBT File Button
			; Do not want main dialog to interfere
			; and cannot use box functions along with dialog
			; so we must exit the dialog execute any .wbt
			; and then restart the dialog
			Return -1
			Break
	
	
		Case 017; WinBatch Studio Button
			wbstudio = StrCat(DirAuxFile(),"WinBatch Studio.exe")
			If !FileExist(wbstudio)
				Message("Cannot Locate WinBatch Studio","Try re-installing WinBatch")
				Return -2
			EndIf
			;Run(wbstudio,"") ; Changed to ShellExecute for VISTA UAC
			ShellExecute(wbstudio,"","",@NORMAL,"")
			Drop(wbstudio)
			Return -2
			Break
	
	
		Case 018; RoboScripter Button
			; Exit main dialog so user doesn't attempt to use
			; roboscripter against the main WinBatch Dialog
			Return -1
			Break
	
		Case 019; Determine Owning EXE Button
			;Cannot use Box function along with dialog
			;so we must exit the dialog execute
			;'Determine Owning EXE' and restart the dialog
			Return -1
			Break
	
	
		Case 020; Track Mouse Coordinates Button
			;Cannot use Box function along with dialog
			;so we must exit the dialog execute
			;'Track Mouse Coordinates' and restart the dialog
			Return -1
			Break
	
	
		Case 21 ;Window Information
			wininfo = StrCat(DirAuxFile(),"Window Information.exe")
			If !FileExist(wininfo)
				Message("Cannot Locate Window Information.exe","Try re-installing WinBatch")
				Return -2
			EndIf
			;Run(wininfo,"")   ; Changed to ShellExecute for VISTA UAC
			ShellExecute(wininfo,"","",@NORMAL,"")
			Drop(wininfo)
			Return -2
			Break
	
		Case 22 ;File Browser
			browser = StrCat(DirAuxFile(),"Browser.exe")
			If !FileExist(browser)
				Message("Cannot Locate Browser.exe","Try re-installing WinBatch")
				Return -2
			EndIf
			;Run(browser,""); Changed to ShellExecute for VISTA UAC
			ShellExecute(browser,"","",@NORMAL,"")
			Drop(browser)
			Return -2
	
			Break
	
	
		Case 024; Windows Interface Language help Button
			helpfile = FilePath(StrSub(DirAuxFile(),1,StrLen(DirAuxFile()) - 1)):'windowsInterfaceLanguage.chm'
			ShellExecute(DirAuxFile():"WILHH.EXE",'"':helpfile:'" "" $global_main',"",@NORMAL,"")
			Return -2
			Break
	
	
		Case 025; WinBatch help Button
			helpfile = FilePath(StrSub(DirAuxFile(),1,StrLen(DirAuxFile()) - 1)):'WinBatch.chm'
			ShellExecute(DirAuxFile():"WILHH.EXE",'"':helpfile:'" "" $global_main',"",@NORMAL,"")
			Return -2
			Break
	
	
	
		Case 026; Tutorial Button
			helpfile = FilePath(StrSub(DirAuxFile(),1,StrLen(DirAuxFile()) - 1)):'ConsolidatedWIL.chm'
			ShellExecute(DirAuxFile():"WILHH.EXE",'"':helpfile:'" "Tutorial" $global_main',"",@NORMAL,"")
			Return -2
			Break
	
	
		Case 029; Keyword Search Button
			HelpwordX = DialogControlGet(MyDialogHandle,DC_Editbox,3);Grab text from Editbox
			HelpWord = ItemExtract(1,HelpwordX,"(")
			;Call(strcat(DirHome(),"WSHELP.DLL"),"REMOTEKEYWORDHELP")
			helpfile = FilePath(StrSub(DirAuxFile(),1,StrLen(DirAuxFile()) - 1)):'ConsolidatedWIL.chm'
			ShellExecute(DirAuxFile():"WILHH.EXE",'"':helpfile:'" "':HelpWord:'" $global_main',"",@NORMAL,"")
			Return -2	
	
	
		Case 031; WinBatch Website Button
			url = "http://www.winbatch.com"
			ShellExecute(url,"","",@NORMAL,"")
			Return -2
			Break
	
	
		Case 032; Tech Support Forum Button
			url = "http://forum.winbatch.com"
			ShellExecute(url,"","",@NORMAL,"")
			Return -2
			Break
	
	
		Case 033; Tech Support Database Button
			url = "http://techsupt.winbatch.com"
			ShellExecute(url,"","",@NORMAL,"")
			Return -2
			Break
	
	
		Case 035; System Information Button
			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 5 ; Intel/AMD native x64
				mode = "Intel/AMD 64-bit %wintype% Windows "
				cpu = ItemExtract(6,WinSysInfo(),@TAB)
				Break
			Case wcx
				cpu = "Unknown CPU"
				mode = "Unknown %wintype% Windows  "
			EndSwitch
			verdata = StrCat(WinVersion(1),".",WinVersion(0))
	
			v = WinVersion(5)
	
			VPlatform = ""
			If v == "1-4-0" Then VPlatform = "95"
			If v == "1-4-10" Then VPlatform = "98"
			If v == "1-4-90" Then VPlatform = "ME"
			If v == "2-3-51" Then VPlatform = "NT 3.51"
			If v == "2-4-0" Then VPlatform = "NT 4.0"
			If v == "2-5-0" Then VPlatform = "2000"
			If v == "2-5-1" Then VPlatform = "XP"
			If v == "2-5-2" Then VPlatform = "2003/XP x64"
			If v == "2-6-0" Then VPlatform = "Vista/2008"
			If v == "2-6-1" Then VPlatform = "7/2008 R2"
			If v == "2-6-2" Then VPlatform = "8/2012"
			If v == "2-6-3" Then VPlatform = "8.1/2012 R2"
			If v == "2-10-0" Then VPlatform = "10"

	
			If VPlatform != ""
				verdata = StrCat(VPlatform," (",verdata,")")
			EndIf
	
			Sysinfo = StrCat(cpu,' ',mode,verdata,@CRLF)
			mouse = "No Mouse"
			If WinMetrics(19) Then mouse = "Mouse"
			Sysinfo = StrCat(sysinfo,math," co-processor.   ",@CRLF,mouse,' available.',@CRLF)
			sysinfo = StrCat(sysinfo,WinMetrics(0),'x',WinMetrics(1)," video resolution.  ",@CRLF,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.")
			Decimals(0)
			Switch wcx
			Case 0
				bug = WinResources(0) / (1024 * 1000.0)	  ; 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," MB 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 * 1000.0)	  ; Get Physical memory avail
				sysinfo = StrCat(sysinfo,@CRLF,bug," MB Physical Memory",@CRLF)
				bug = (WinResources(14) / (1024 * 1000.0)) + bug	; Get Virtual memory + Physical avail
				sysinfo = StrCat(sysinfo,bug," MB Total Memory",@CRLF)
			End Switch
			Decimals(-1)
			sysinfo = StrCat(sysinfo,"Console ",DosVersion(1),'.',DosVersion(0),"  using ",Environment("COMSPEC"),@CRLF)
			disks = DiskScan(1)
			disks = StrReplace(disks,@TAB," ")
			If disks == "" Then disks = "none"
			sysinfo = StrCat(sysinfo,"Floppies - ",disks,@CRLF)
			disks = DiskScan(8)
			disks = StrReplace(disks,@TAB," ")
			If disks == "" Then disks = "none"
			sysinfo = StrCat(sysinfo,"Cd-Roms - ",disks,@CRLF)
			disks = DiskScan(2)
			disks = StrReplace(disks,@TAB," ")
			If disks == "" Then disks = "none"
			sysinfo = StrCat(sysinfo,"Hard Disks - ",disks,@CRLF)
			disks = DiskScan(4)
			disks = StrReplace(disks,@TAB," ")
			If disks == "" Then disks = "none"
			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(),@CRLF)
	
	
	
			ver = Version()
			Message("WinBatch %ver% SysInfo",Sysinfo)
			Drop(sysinfo,wintype,wcx,math,wc,mode,cpu,bug,disks)
			Return -2
			Break
	
	
		Case 036; Advanced Options Button
			AdvFormat = `WWWDLGED,6.1`
			AdvCaption = `Advanced Options`
			AdvX = -01
			AdvY = -01
			AdvWidth = 147
			AdvHeight = 097
			AdvNumControls = 004
			AdvProcedure = `DEFAULT`
			AdvFont = `DEFAULT`
			AdvTextColor = `DEFAULT`
			AdvBackground = `DEFAULT,DEFAULT`
	
			Adv001 = `044,078,046,011,PUSHBUTTON,DEFAULT,"OK",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			Adv002 = `007,006,128,067,GROUPBOX,DEFAULT,"Advanced",DEFAULT,3,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
			Adv003 = `023,024,088,010,PUSHBUTTON,DEFAULT,"Uninstall WinBatch",2,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
			Adv004 = `023,045,088,010,PUSHBUTTON,DEFAULT,"Foreign Language Support",3,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	
			ButtonPushed = Dialog("Adv")
			Switch ButtonPushed
	
			Case 1 ;Ok
				Return -2
				Break
	
	
			Case 2 ;Uninstall WinBatch
				; Uninstall WinBatch Button
				a = DirAuxFile()
				b = FileLocate(StrCat(a,"uninstal.exe"))
				If b == ""
					Message("Error",StrCat("Uninstall program (uninstal.exe) not found at",@CRLF,b))
					Return -1
				EndIf
				;Run(b,"")  ;VISTA UAC FIX
				ShellExecute(b,"","",@NORMAL,"")
				Exit
				Break
	
	
			Case 3
				DirChange(DirAuxFile())
				Message("WinBatch Language Changer","This option will change the language used on buttons in some dialog boxes and error messages.")
				MyDialogFormat = `WWWDLGED,6.1`
	
				MyDialogCaption = `WIL Language Selector`
				MyDialogX = 060
				MyDialogY = 079
				MyDialogWidth = 289
				MyDialogHeight = 145
				MyDialogNumControls = 006
				MyDialogProcedure = `DEFAULT`
				MyDialogFont = `DEFAULT`
				MyDialogTextColor = `DEFAULT`
				MyDialogBackground = `DEFAULT,DEFAULT`
				MyDialogConfig = 0
	
				MyDialog001 = `002,066,278,056,ITEMBOX,Choice,DEFAULT,DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
				MyDialog002 = `015,022,270,010,VARYTEXT,current,"Vary 1",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
				MyDialog003 = `054,126,063,010,PUSHBUTTON,DEFAULT,"&Ok",1,3,32,DEFAULT,DEFAULT,DEFAULT`
				MyDialog004 = `148,126,064,010,PUSHBUTTON,DEFAULT,"&Cancel",0,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
				MyDialog005 = `010,006,114,010,STATICTEXT,DEFAULT,"Current Language is:",DEFAULT,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
				MyDialog006 = `010,046,272,010,STATICTEXT,DEFAULT,"Select desired language",DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	
				;Determine current language
	
				Current = IniReadPvt("Main","Language","NONE",MyIniDir():"WWWBATCH.INI")
				If Current == "NONE"
					current = "English"
				Else
					If StrLen(Current) != 3 Then current = "enu"
					current = IniReadPvt("Main","Description","Unknown",StrCat(DirAuxFile(),"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(DirAuxFile(),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
					ButtonPushed = 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",MyIniDir():"WWWBATCH.INI")
					Message("English chosen as langauge","DLL Will use internal strings instead of language file")
				Else
					IniWritePvt("Main","Language",ext,MyIniDir():"WWWBATCH.INI")
					Message("Language","Language set to %Choice%")
				EndIf
	
				IntControl(26,0,0,0,0)   ;Tell DLL to reset language strings
	
				Return -2
				Break
			EndSwitch
	
			Break
	
		Case 43  ;Compiler Button
			wbc = StrCat(DirHome(),"Wbcompiler.exe")
			If !FileExist(wbc) Then Return -2
			;Run(wbc,"")  ;VISTA UAC FIX
			ShellExecute(wbc,"","",@NORMAL,"")
			Drop(wbc)
			Return -2
			Break
	
		EndSwitch   ;DC_ButtonPressed
		Break
	EndSwitch ; MyDialogMessage
	
	Return(-1) ; Do default processing
	#EndFunction


;***************************************************************************
;***************************************************************************
;***************************************************************************
;***************************************************************************
;***************************************************************************
;***************************************************************************
;***************************************************************************
;***************************************************************************
;***************************************************************************
;** The real start of the program
;** Initializing
;**
;***************************************************************************

If RtStatus() != 0
	Display(4,"Debug","Warning.  Running in debug mode")
EndIf
;Most of the problems are in the WinExeName("") function
;which can be commented out for debugging, realizing a few functions that use
;WinExename("") will be upset



IntControl(72,2,0,0,0)
CancelHappened = @FALSE
CancelOption = 0

;***************************************************************************
;** check if maintenance has expired If expired or about to expire, (within a month) offer to take them to website
;do this in a seperate thread
If param0 != 0
	If param1 == "MAINTCHECK"
		BoxTitle("WB MaintCheck")
		NoShow = IniReadPvt("RenewCheck",Version(),0,wwwprodini())
		If NoSHow == 0 Then IsExpired()
		Exit
	EndIf
EndIf
;***************************************************************************

if WinMetrics(-2) != 3	; Don't perform the maintaince check when native 64-bit.
	If RtStatus() == 0
		ShellExecute(WinExename(""),StrCat('"',IntControl(1004,0,0,0,0),'" MAINTCHECK'),"",@NORMAL,"")
	Else
		Display(3,"Debug","Skipping maintcheck for debug")
	EndIf
endif

BoxTitle("WB Navigator")

ver = StrUpper(Version())
verdll = StrUpper(VersionDLL())
letters = StrUpper(StrSub(verdll,StrLen(verdll) - 1,2))
If StrLen(ver) == 3
	wildll = StrCat("WBD",letters,"32I.DLL")
ElseIf ver <= "2004A"
	wildll = StrCat("WBD",letters,"34I.DLL")
ElseIf WinMetrics(-2) == 3
	wildll = StrCat("WBD",letters,"64I.DLL")
Else
	wildll = StrCat("WBD",letters,"44I.DLL")
EndIf
oledll = "" ; rem for OLE dll removel in 2004b StrCat("WBO",letters,"34I.DLL")
intro1 = "Welcome to the world of WinBatch."
intro2 = "WinBatch can be used for managing Windows desktops, unattended jobs, scheduled jobs, LAN access and administration, login scripting, serial communications, data access, and more."
intro3 = "Feel free to look around."
intro = StrCat(intro1,@CRLF,@CRLF,intro2,@CRLF,@CRLF,intro3)

;Grab Computername
sysinfo = WinSysInfo()
computername = StrUpper(ItemExtract(1,sysinfo,@TAB))

os = WinVersion(4)
If os == 5
	;95/98/ME
	;The UserDomain property does not work on Windows98 and Windows ME unless the USERDOMAIN environment variable is set.
	;The variable is not set by default.
	domain = StrUpper(Environment("USERDOMAIN"))
	If domain == ""
		If !RegExistValue(@REGMACHINE,"System\CurrentControlSet\Services\VxD\VNETSUP[Workgroup]")
			domain = "unknown"
			dmsstring = "WorkGroup:"
		Else
			domain = StrUpper(RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\VxD\VNETSUP[Workgroup]"))
			dmsstring = "WorkGroup:"
		EndIf
		If !RegExistValue(@REGMACHINE,"Network\Logon[username]") Then username = "unknown"
		Else username = StrUpper(RegQueryValue(@REGMACHINE,"Network\Logon[username]"))
	EndIf
Else
	;NT 4/2000/XP
	;domain = StrUpper(Environment("USERDOMAIN"))
	If !RegExistValue(@REGMACHINE,"Software\Microsoft\Windows NT\CurrentVersion\winlogon[CachePrimaryDomain]")
		ErrorMode(@OFF)
		If WinMetrics(-2) == 3
			If FileExist("wwwnt64I.dll") Then flag = AddExtender("wwwnt64i.dll",32022)
			Else flag = 0
		ElseIf FileExist("wwwnt44I.dll")
			flag = AddExtender("wwwnt44i.dll",32002)
		ElseIf FileExist("wwwnt34I.dll")
			flag = AddExtender("wwwnt34i.dll",32002)
		Else
			flag = 0
		EndIf
		If flag == 0
			domain = "*UNKNOWN*"
		Else
			domain = wntLsaPolGet("","PrimaryDomain",1)
		EndIf
		ErrorMode(@CANCEL)
		If domain == 0 Then domain = "unknown"
		dmsstring = "WorkGroup:"
	Else
		domain = RegQueryValue(@REGMACHINE,"Software\Microsoft\Windows NT\CurrentVersion\winlogon[CachePrimaryDomain]")
		dmsstring = "Domain:"
	EndIf
	username = StrUpper(Environment("USERNAME"))
EndIf

If WinMetrics(-2) == 3 then strCaption = "WinBatch Navigator (64-bit)"
else strCaption = "WinBatch Navigator (32-bit)"
	
Robo_ButtonVal = 6
Owning_ButtonVal = 7
Tracker_ButtonVal = 8
RunWBT_ButtonVal = 4

;***************************************************************************
;**
;** Dialog
;**
;***************************************************************************
While @TRUE

	MainFormat = `WWWDLGED,6.1`
	MainCaption = strCaption
	MainX = -01
	MainY = -01
	MainWidth = 350
	MainHeight = 235
	MainNumControls = 043
	MainProcedure = `MainProc`
	MainFont = `DEFAULT`
	MainTextColor = `0|0|0`
	MainBackground = `DEFAULT,DEFAULT`

	Main001 = `007,095,070,008,STATICTEXT,DEFAULT,"WinBatch Version:",DEFAULT,90,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main002 = `007,103,070,008,VARYTEXT,ver,DEFAULT,DEFAULT,91,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main003 = `007,113,070,007,STATICTEXT,DEFAULT,"WinBatch DLL Version:",DEFAULT,92,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main004 = `007,121,070,007,VARYTEXT,verdll,DEFAULT,DEFAULT,93,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main005 = `007,130,070,008,STATICTEXT,DEFAULT,"WIL DLL:",DEFAULT,94,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main006 = `007,138,070,008,VARYTEXT,wildll,DEFAULT,DEFAULT,95,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main007 = `007,146,070,008,VARYTEXT,oledll,DEFAULT,DEFAULT,96,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main008 = `079,006,262,206,GROUPBOX,DEFAULT,"Welcome to WinBatch",DEFAULT,101,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main009 = `007,007,065,086,PICTURE,DEFAULT,"Howland",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,"WBPrgn.bmp"`
	Main010 = `010,214,062,010,PUSHBUTTON,DEFAULT,"License Info",2,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main011 = `161,215,094,010,PUSHBUTTON,DEFAULT,"Exit",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main012 = `084,015,121,083,GROUPBOX,DEFAULT,"Introduction",DEFAULT,100,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main013 = `087,023,112,070,VARYTEXT,Intro,DEFAULT,DEFAULT,97,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main014 = `097,113,094,010,PUSHBUTTON,DEFAULT,"Getting Started - on the web",3,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main015 = `210,097,128,110,GROUPBOX,DEFAULT,"Utilities",DEFAULT,105,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main016 = `226,108,094,010,PUSHBUTTON,DEFAULT,"Run a .WBT file",4,13,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main017 = `226,119,094,010,PUSHBUTTON,DEFAULT,"WinBatch Studio",5,14,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main018 = `226,130,094,010,PUSHBUTTON,DEFAULT,"Roboscripter",6,15,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main019 = `226,141,094,010,PUSHBUTTON,DEFAULT,"Determine Owning EXE",7,16,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main020 = `226,152,094,010,PUSHBUTTON,DEFAULT,"Track Mouse Coordinates",8,17,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main021 = `226,163,094,010,PUSHBUTTON,DEFAULT,"Window Information",18,18,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main022 = `226,174,094,010,PUSHBUTTON,DEFAULT,"File Browser",19,19,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main023 = `209,014,127,074,GROUPBOX,DEFAULT,"Help Files",DEFAULT,104,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main024 = `225,026,094,010,PUSHBUTTON,DEFAULT,"Windows Interface Language",9,8,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main025 = `225,037,094,010,PUSHBUTTON,DEFAULT,"WinBatch",10,9,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main026 = `225,048,094,010,PUSHBUTTON,DEFAULT,"Tutorial",11,10,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main027 = `214,063,089,010,STATICTEXT,DEFAULT,"WinBatch Function Lookup:",DEFAULT,98,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main028 = `214,071,073,011,EDITBOX,keyword,"Edit 1",DEFAULT,11,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main029 = `287,071,040,010,PUSHBUTTON,DEFAULT,"Search",12,12,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main030 = `082,103,123,061,GROUPBOX,DEFAULT,"On The Web",DEFAULT,102,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main031 = `097,124,094,010,PUSHBUTTON,DEFAULT,"WinBatch Website",13,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main032 = `097,135,094,010,PUSHBUTTON,DEFAULT,"Tech Support Forum",14,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main033 = `097,146,094,010,PUSHBUTTON,DEFAULT,"Tech Support Database",15,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main034 = `082,167,123,040,GROUPBOX,DEFAULT,"Tasks",DEFAULT,103,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main035 = `097,180,094,010,PUSHBUTTON,DEFAULT,"System Information",16,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main036 = `097,191,094,010,PUSHBUTTON,DEFAULT,"Advanced Options",17,7,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main037 = `007,174,070,007,STATICTEXT,DEFAULT,"Computer Name:",DEFAULT,37,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main038 = `007,182,070,007,VARYTEXT,computername,DEFAULT,DEFAULT,38,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main039 = `007,156,070,008,STATICTEXT,DEFAULT,"Logged in User Name:",DEFAULT,39,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main040 = `007,164,070,008,VARYTEXT,username,DEFAULT,DEFAULT,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main041 = `007,191,070,008,VARYTEXT,dmsstring,"Domain\Workgroup:",DEFAULT,41,DEFAULT,"Microsoft Sans Serif|5325|70|34",DEFAULT,DEFAULT`
	Main042 = `007,199,069,008,VARYTEXT,domain,DEFAULT,DEFAULT,42,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
	Main043 = `226,185,094,010,PUSHBUTTON,DEFAULT,"Compiler",20,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

	ButtonPushed = Dialog("Main")



	; 'Run .WBT file' Button was pushed
	If ButtonPushed == RunWBT_ButtonVal
		samplesdir = StrReplace(StrLower(DirAuxFile()),"system","samples")
		If DirExist(samplesdir) == @FALSE Then samplesdir = ""
		runwbtdir = IniReadPvt("WINBATCH","RUNWBT",samplesdir,wwwprodini())
		If DirExist(runwbtdir) == @FALSE Then runwbtdir = ""
		CancelOption = 1
		xyzzywbtfile = StrLower(AskFilename("WinBatch",runwbtdir,"WinBatch (*.WBT)|*.WBT","*.WBT",1))
		CancelOption = 0
		If CancelHappened == @TRUE
			CancelHappened = @FALSE
			Continue
		EndIf
		runwbtdir = FilePath(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
			IniWritePvt("WINBATCH","RUNWBT",FilePath(xyzzywbtfile),wwwprodini())
			If RtStatus() == 0
				RunWait(WinExename(""),xyzzywbtfile)           ; Possible VISTA UAC issues ?????
			Else
				Display(5,"Debug","Skipping of launch of WBT file for debug")
			EndIf
			;exit
		EndIf
		Drop(samplesdir,runwbtdir,xyzzywbtfile)
		Continue
	EndIf



	; 'Roboscripter' Button was pushed
	If ButtonPushed == Robo_ButtonVal
		; Exit main dialog so user doesn't attempt to use
		; roboscripter against the main WinBatch Dialog
		; and restart the dialog
		roboscripter = StrCat(DirAuxFile(),"RoboScrp.w32")
		If !FileExist(roboscripter)
			Message("Cannot Locate RoboScripter","Try re-installing WinBatch")
			Continue
		EndIf
		RunWait(roboscripter,"")
		Drop(roboscripter)
		Continue
	EndIf

	; 'Determine Owning EXE' Button was pushed
	If ButtonPushed == Owning_ButtonVal
		; Cannot use Box function along with dialog
		; so we must exit the dialog execute
		; 'Determine Owning EXE' and restart the dialog

		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()
		Continue
	EndIf

	; 'Track Mouse Coordinates' Button was pushed
	If ButtonPushed == Tracker_ButtonVal
		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)
			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()
		Continue
	EndIf
	Break
EndWhile



:CANCEL
IntControl(72,2,0,0,0)
CancelHappened = @TRUE
If CancelOption != 0 Then Return
Exit


