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 from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

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

Switchboard WinBatch


I don't know if anyone else would find this code useful but here you go. The Switchboard WinBatch will dynamically create buttons for all the executables in the same folder as the compiled Switchboard WinBatch. This way if I want to distribute another WinBatch to my guys, I just have to put it in the same folder and a new button will show up in the Switchboard.

apppath = dirget()
title = "Switchboard"
boxtitle(title)
buttons = fileitemize("%apppath%*.exe")
index=ItemLocate("Switchboard.exe", buttons, @tab)
buttons = ItemRemove(index, buttons, @TAB)
buttons = strreplace(buttons,".exe","")
buttons = itemsort(buttons,@tab)
buttons = strcat(buttons,@tab,"E&xit")
buttoncount = itemcount(buttons,@tab)

:start
MyDialogFormat=`WWWDLGED,6.1`

MyDialogCaption=`%title%`
MyDialogX=-01
MyDialogY=-01
MyDialogWidth=103
MyDialogHeight=(12 * buttoncount) + 2 * (buttoncount-1) + 8
MyDialogNumControls=buttoncount
MyDialogProcedure=`DEFAULT`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

spot = 3
for x = 1 to buttoncount
	button = itemextract(x,buttons,@tab)
	if x == 1
		ctrlnum = StrFixLeft(x,"0",3)
		MyDialog%ctrlnum%=`003,%spot%,094,012,PUSHBUTTON,DEFAULT,%button%,%x%,%x%,32,DEFAULT,DEFAULT,DEFAULT`
	else
		ctrlnum = StrFixLeft(x,"0",3)
		spot = spot + 14
		MyDialog%ctrlnum%=`003,%spot%,094,012,PUSHBUTTON,DEFAULT,%button%,%x%,%x%,32,DEFAULT,DEFAULT,DEFAULT`
	endif
next
ButtonPushed=Dialog("MyDialog")

if buttonpushed == buttoncount then exit

buttonname = itemextract(buttonpushed,buttons,@tab)
run("%apppath%%buttonname%.exe","")
goto start


Article ID:   W16207
File Created: 2004:03:30:15:43:14
Last Updated: 2004:03:30:15:43:14