WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Auto Configure Dialog


; Configurable Toolbar
; By: Yair Kronenberg
; Modified 4/10/2004

NumberOfButtons = 0

If !FileExist("Toolbar.dat")
    Message("Error","This script needs Toolbar.dat inorder to run")
	 exit
Endif
datfile = FileOpen("Toolbar.dat", "READ")
while @true
	line = FileRead(datfile)
	If line == "*EOF*" Then Break
	if StrSub(line, 1, 4) == "NAME" then NumberOfButtons = NumberOfButtons + 1
endwhile
FileClose(datfile)

TheTable = ArrDimension(NumberOfButtons,5)
datfile = FileOpen("Toolbar.dat", "READ")
for x = 0 to NumberOfButtons - 1
	y = 0
	while y != 5
		line = FileRead(datfile)
		if line == "*EOF*" then Break
		if line == "" then Continue
		TheTable[x,y] = StrSub(line, 6, -1)
		y = y+1
	endwhile
next
FileClose(datfile)

; Adding system menus to WIL popup windows
;IntControl (49, 1, 0, 0, 0)
MyDialogFormat=`WWWDLGED,6.1`

MyDialogCaption=`Toolbar based on contents of Toolbar.dat`
MyDialogX=071
MyDialogY=247
MyDialogWidth=134
MyDialogHeight=30+22*NumberOfButtons
MyDialogNumControls=3+NumberOfButtons
MyDialogProcedure=`DEFAULT`
MyDialogFont=`Arial|6656|70|34`
MyDialogTextColor=`0|0|0`
MyDialogBackground=`DEFAULT,192|192|192`
MyDialogConfig=0
for i = 1 to NumberOfButtons
	k = i
	if i < 100 && i >= 10 then k = StrCat("0", i)
	if i < 10 then k = StrCat("00", i)
	ButtonYCoord = 17 + 20*(i-1)
	ButtonName = TheTable[i-1,0]
	MyDialog%k%=`011,%ButtonYCoord%,110,012,PUSHBUTTON,DEFAULT,"%ButtonName%",%i%,%i%,0,DEFAULT,DEFAULT,DEFAULT`
next
GroupBoxYend = MyDialogHeight - 33
ExitButtonYCoord = MyDialogHeight - 20
k = NumberOfButtons + 1
if NumberOfButtons + 1 < 100 && NumberOfButtons + 1 >= 10 then k = StrCat("0", NumberOfButtons + 1)
if NumberOfButtons + 1 < 10 then k = StrCat("00", NumberOfButtons + 1)
MyDialog%k%=`005,009,120,%GroupBoxYend%,GROUPBOX,DEFAULT,DEFAULT,DEFAULT,11,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
k = NumberOfButtons + 2
if NumberOfButtons + 2 < 100 && NumberOfButtons + 2 >= 10 then k = StrCat("0", NumberOfButtons + 2)
if NumberOfButtons + 2 < 10 then k = StrCat("00", NumberOfButtons + 2)
MyDialog%k%=`007,001,118,010,VARYTEXT,error,DEFAULT,DEFAULT,11,512,"Arial|6656|40|34","0|128|0",DEFAULT`
k = NumberOfButtons + 3
if NumberOfButtons + 3 < 100 && NumberOfButtons + 3 >= 10 then k = StrCat("0", NumberOfButtons + 3)
if NumberOfButtons + 3 < 10 then k = StrCat("00", NumberOfButtons + 3)
MyDialog%k%=`011,%ExitButtonYCoord%,110,012,PUSHBUTTON,DEFAULT,"EXIT",0,10,32,DEFAULT,DEFAULT,"255|0|0"`

ButtonPushed=Dialog("MyDialog")

exit


This file determines button on the dialog.

Toolbar.dat

NAME:Notepad
EXEC:c:\windows\notepad.exe
PARA:
HIDE:0
WAIT:0

NAME:Excel
EXEC:\\myserver\myshare\excel.exe
PARA:\\myserver\myshare\my.xls
HIDE:0
WAIT:0

NAME:Winbatch
EXEC:c:\program files\winbatch\system\winbatch.exe
PARA:
HIDE:0
WAIT:0

Article ID:   W16418
File Created: 2005:02:18:12:20:28
Last Updated: 2005:02:18:12:20:28