Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Dialog Version 5.0 Help Documentation WIL Dialog Editor Older OLD
[Note: Another way to create graghical dialogs, is to use the HTML Extender. For further information see the HTML extender help file.] It displays a graphical representation of a dialog box, and allows you to create, modify, and move individual controls which appear in the dialog box. After you have defined your dialog box, the Dialog Editor will generate the appropriate WIL code, which you can save to a file or copy to the Clipboard for pasting into your WIL program.You can include the dialog template code directly in your batch code, or you can use the batch language "Call" command to execute the dialog template.
For example:
Call("Sample.WDL", "")
Note: Visual programming of dialog boxes is quick and accurate. Use generic variable names so you can reuse your favorite dialogs. You can have as many as 100 controls in a WinBatch dialog. However, too many controls can be confusing. Aim for simple dialogs with a consistent appearance between different ones.
New
When you select New, any currently loaded template will be discarded and the slate will be clean for a new dialog. You will be prompted to enter the caption (title) for your dialog box, and a WIL variable name used to refer to the dialog box in the WIL scripts.LoadLoads a dialog template from a file.Save
Saves a dialog template to the current file.Save As
Saves the dialog template to a file using a different filename.Load from Clipboard
Loads a dialog template from the Windows Clipboard.Save to Clipboard
Saves the dialog template to the Windows Clipboard.
Change Caption/Name
Allows you to change the Dialog caption (title) and/or the variable name used to refer to the dialog. Note: Left Mouse double-clicking the dialog box background will also execute this menu item.Add Control
Adds a new control to your dialog template. Note: Right Mouse double-clicking has the same effect.Delete Control
Surprisingly enough, Delete Control does not actually delete a control. It just reminds you how to do it. To delete a control, position the mouse cursor over the control and press the delete key.Show Script
Displays the WIL script generated during the dialog edit session. Once you learn how the dialog scripts operate, viewing the script is a quick way to scan for errors. You will notice that some script lines cannot be viewed in their entirety, in which case simply double click it to view the entire line.GUI Font
Uses the new style font in the dialog for Windows 95/98/ME/4.0/2000/XP. If running Windows 95/98/ME/4.0/2000/XP the GUI font is used as default. Note: Intcontrol(52,0,1,0,0) can change font to be displayed as system font.System Font
Uses the System font in the dialog for Windows 3.x and NT 3.5. If running Windows 3.x or NT 3.5 the System font is used as default.
Dialog Editor Help
Displays the Index of the On-line help information.How to use Help
Activates the Microsoft Windows Index to Using Help.About
Displays the WIL Dialog Editor About dialog which includes the version number of the program.
Run("example.wdl", "") ;or Call("example.wdl", "")With a little copying and pasting, a dialog box can be completely integrated into a WIL script. The Dialog Editor File/Save to Clipboard feature allows an easy way to put the code into the clipboard. Use the keyboard command 'Control v' to paste the code into the script. The entire code can be placed at the point in the script at which it will be executed. However, if the dialog box needs to be accessed multiple times, it is more efficiently utilized as a sub-routine. A GoSub command will send the WIL processing to the dialog sub-routine and return to the point of origin. (See the WIL manual or on-line help for more information on GoSub) Alternatively, execution of a dialog box will occur whenever the dialogs final statement is encountered in the script. ButtonPushed=Dialog("mydialog") Example:
miniFormat=`WWWDLGED,5.0` miniCaption=`Mini Example` miniX=100 miniY=42 miniWidth=132 miniHeight=73 miniNumControls=4 mini01=`40,56,51,DEFAULT,PUSHBUTTON,DEFAULT,"GO",1` mini02=`6,22,51,DEFAULT,RADIOBUTTON,station,"am",1` mini03=`6,38,51,DEFAULT,RADIOBUTTON,station,"fm",2` mini04=`28,4,75,DEFAULT,STATICTEXT,DEFAULT,"Just a quickie example"` ButtonPushed=Dialog("mini") Message("Times Run", "1") ButtonPushed=Dialog("mini") Message("Times Run", "2") ButtonPushed=Dialog("mini") Message("Times Run", "3")
ExampleFormat=`WWWDLGED,5.0` ExampleCaption=`Dialog Editor Example` ExampleX=120 ExampleY=50 ExampleWidth=179 ExampleHeight=160 ExampleNumControls=12 Example01=`16,136,72,DEFAULT,PUSHBUTTON,DEFAULT,"OK",1` Example02=`97,136,72,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",0` Example03=`120,40,48,DEFAULT,RADIOBUTTON,music,"Blues",1` Example04=`120,56,56,DEFAULT,RADIOBUTTON,music,"Jazz",2` Example05=`120,72,56,DEFAULT,RADIOBUTTON,music,"Rock",3` Example06=`24,104,112,DEFAULT,CHECKBOX,volume,"LOUD!",1` Example07=`24,120,104,DEFAULT,CHECKBOX,volume2,"Quiet",2` Example08=`8,88,64,DEFAULT,STATICTEXT,DEFAULT,"VOLUME"` Example09=`9,6,164,DEFAULT,STATICTEXT,DEFAULT,"Music Selection - What is your listening pleasure?"` Example10=`16,40,48,40,ITEMBOX,tunes,DEFAULT` Example11=`112,24,56,DEFAULT,STATICTEXT,DEFAULT,"Type Preferred?"` Example12=`16,24,49,DEFAULT,VARYTEXT,song,"Choose a title"` ButtonPushed=Dialog("Example")
ExampleFormat=`WWWDLGED,5.0'The next section establishes the caption which will appear in the title bar of the dialog box along with the coordinates, size and number of controls in the dialog box. ExampleCaption=`Dialog Editor Example`
ExampleX=120 ExampleY=50 ExampleWidth=179 ExampleHeight=160 ExampleNumControls=12The third section contains the code for the actual controls. Each line has specific information.
Example01=`16,136,72,DEFAULT,PUSHBUTTON,DEFAULT,"OK",1` Example02=`97,136,72,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",0` Example03=`120,40,48,DEFAULT,RADIOBUTTON,music,"Blues",1` Example04=`120,56,56,DEFAULT,RADIOBUTTON,music,"Jazz",2` Example05=`84,41,38,DEFAULT,RADIOBUTTON,music,"Rock",3`When the first line in the example above is broken down, the parts are as follows.
Code Definition ---- ----------- Example Dialog Variable Name 01 Control Number 27,113,76,DEFAULT Coordinates of the control PUSHBUTTON Control Type "DEFAULT" Variable name OK Text 1 ValueEach Dialog script will end with the following line, making it easy to test the PushButton return values.
ButtonPushed=Dialog("Example")Assembled with the variables, the completed script looks like the following.
;set variables ;the list for the item box. tunes="My Shirona%@tab%In the Mood%@tab%StayingAlive%@tab%RockLobster%@tab%Tequila" ;the contents of the varytext. song="Yellow Submarine" music=2 ;sets this radiobutton as default volume=1 ;pre-selects checkbox. ExampleFormat=`WWWDLGED,5.0` ExampleCaption=`Music Selection` ExampleX=120 ExampleY=50 ExampleWidth=129 ExampleHeight=138 ExampleNumControls=13 Example01=`8,116,52,DEFAULT,PUSHBUTTON,DEFAULT,"OK",1` Example02=`68,116,52,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",0` Example03=`84,75,38,DEFAULT,RADIOBUTTON,music,"Blues",1` Example04=`84,59,38,DEFAULT,RADIOBUTTON,music,"Jazz",2` Example05=`84,41,38,DEFAULT,RADIOBUTTON,music,"Rock",3` Example06=`46,94,38,DEFAULT,CHECKBOX,volume,"LOUD!",1` Example07=`84,94,38,DEFAULT,CHECKBOX,volume2,"Quiet",2` Example08=`8,94,38,DEFAULT,STATICTEXT,DEFAULT,"VOLUME"` Example09=`6,4,112,DEFAULT,STATICTEXT,DEFAULT,"What is your listening pleasure?"` Example10=`6,51,65,40,ITEMBOX,tunes,DEFAULT` Example11=`70,24,56,DEFAULT,STATICTEXT,DEFAULT,"Type Preferred?"` Example12=`6,20,60,DEFAULT,VARYTEXT,song,"Choose a title"` Example13=`6,36,64,DEFAULT,EDITBOX,song," "` ButtonPushed=Dialog("Example")
In the script example, the variables are set at the top.
;;set variables ;;the list for the item box. tunes="My Shirona%@tab%In the Mood%@tab%StayingAlive%@tab%RockLobster" ;;the contents of the varytext. song="Yellow Submarine" music=2 ;sets the radiobutton as default volume=1 ;pre-selects checkbox.
To MOVE the control, click on it and drag it to a new position with the left mouse button.
To SIZE a control, click on the edge and drag with the left mouse button.
To DELETE a control, position the mouse over the control and press the delete key.
Some of the Controls require extra knowledge or special handling.
Buttonpushed=Dialog("MyDialog")To test the return value do the following:
If Buttonpushed == 1 then goto label"Cancel" or the value 0 will generally look for a label :cancel. If no such label is found, the script will exit. For more information on "Cancel", see the Windows Interface Language manual or on-line WIL help file.
For example, the script in a Dialog may look like:
Example03=`120,40,48,DEFAULT,RADIOBUTTON,music,"Blues",1` Example04=`120,56,56,DEFAULT,RADIOBUTTON,music,"Jazz",2`The variable "music" is the same on both lines but the text and the values are different.
Note: Radio Button cannot have a value of 0.
To test the return value, the variable can be placed in an If structure.
If music == 1 Message("Music", "Let's play the blues.") else Message("Music", "Let's play the Jazz.") endifDon't limit yourself to using if/endif statements. The Switch structure provides a more efficient way to test multiple values. For more information on Switch, see the Windows Interface Language manual or on-line WIL help file.
Example:
MonsterFormat=`WWWDLGED,5.0` MonsterCaption=`Monster Masher` MonsterX=63 MonsterY=79 MonsterWidth=128 MonsterHeight=141 MonsterNumControls=14 Monster01=`3,38,51,DEFAULT,CHECKBOX,tail,"Spiked Tail",1` Monster02=`59,38,51,DEFAULT,CHECKBOX,horn,"Horns",1` Monster03=`3,54,51,DEFAULT,CHECKBOX,claw,"Claws",1` Monster04=`3,70,51,DEFAULT,CHECKBOX,teeth,"Fangs",1` Monster05=`3,22,51,DEFAULT,CHECKBOX,eye,"Beady Eyes",1` Monster06=`3,6,104,DEFAULT,STATICTEXT,DEFAULT,"Select your monsters features."` Monster07=`6,121,112,DEFAULT,PUSHBUTTON,DEFAULT,"Build my Monster",1` Monster08=`59,54,51,DEFAULT,CHECKBOX,mole,"Hairy Mole",1` Monster09=`3,86,51,DEFAULT,CHECKBOX,flesh,"Green Skin",1` Monster10=`3,102,51,DEFAULT,CHECKBOX,nose,"Grecian Nose",1` Monster11=`59,86,62,DEFAULT,CHECKBOX,hands,"Webbed Fingers",1` Monster12=`59,102,60,DEFAULT,CHECKBOX,foot,"Cloven Hooves",1` Monster13=`59,22,51,DEFAULT,CHECKBOX,wings,"Feathers",1` Monster14=`59,70,67,DEFAULT,CHECKBOX,thumb,"Opposable Thumb",1` ButtonPushed=Dialog("Monster") ;To test the return value, the variables can be placed in If structures. If mole && claw == 1 Message("Monster", "If you scratch my back, I'll bleed to death.") endif If eye || thumb Message("Not a monster", 'Jack is a psychopath, "Here's Johnny!"') endifLogical operators can be used when checking for the return of several variables; && is logical and, || is logical or. For more information on operators, see the Windows Interface Language manual or on-line WIL help file.
:top ;set the password variables PW_pass1="" PW_pass2="" passwordFormat=`WWWDLGED,5.0` passwordCaption=`PASSWORD` passwordX=54 passwordY=70 passwordWidth=118 passwordHeight=82 passwordNumControls=4 password01=`3,59,51,DEFAULT,PUSHBUTTON,DEFAULT,"OK",1` password02=`62,59,51,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",0` password03=`3,25,110,DEFAULT,EDITBOX,PW_pass1,""` password04=`3,8,110,DEFAULT,STATICTEXT,DEFAULT,"Please enter your new password."` ;this statement initializes the box. ButtonPushed=Dialog("password")Minor changes can be made to the dialog box without having to include the entire dialog box code.
;;initialize the box again with a couple of minor changes. password03=`3,25,110,DEFAULT,EDITBOX,PW_pass2,""` password04=`3,8,110,DEFAULT,STATICTEXT,DEFAULT,"Please verify your new password."` ButtonPushed=Dialog("password")To test the return value, the variables can be placed in If structures.
;test the return values If PW_pass1 == PW_pass2 Message("Password", "Thanks, your new password is in effect") Fail=0 else Message("Password Failed", "They didn't match, please try again.") Fail=1 endif If Fail == 1 then goto top
fixedtextFormat=`WWWDLGED,5.0` fixedtextCaption=`Fixed Text Example` fixedtextX=119 fixedtextY=68 fixedtextWidth=130 fixedtextHeight=155 fixedtextNumControls=10 fixedtext01=`3,4,107,DEFAULT,STATICTEXT,DEFAULT,"You can type whatever you'd like "` fixedtext02=`3,33,121,DEFAULT,STATICTEXT,DEFAULT,"no matter what you type, the field has"` fixedtext03=`3,62,120,DEFAULT,STATICTEXT,DEFAULT,"characters. If you need to display"` fixedtext04=`3,76,115,DEFAULT,STATICTEXT,DEFAULT,"more information, simply create "` fixedtext05=`3,91,120,DEFAULT,STATICTEXT,DEFAULT,"several Fixed Text fields and arrange "` fixedtext06=`3,19,112,DEFAULT,STATICTEXT,DEFAULT,"into the Fixed Text field. However,"` fixedtext07=`3,48,115,DEFAULT,STATICTEXT,DEFAULT,"a visual limit of approximately 60 "` fixedtext08=`3,105,67,DEFAULT,STATICTEXT,DEFAULT,"them accordingly."` fixedtext09=`8,131,51,DEFAULT,PUSHBUTTON,DEFAULT,"comprendé",1` fixedtext10=`68,131,51,DEFAULT,PUSHBUTTON,DEFAULT,"no comprendé",0` ButtonPushed=Dialog("fixedtext")
;Grab the date for display in the dialog box. dadate=Timedate() wkday=ItemExtract(1, dadate, " ") date=ItemExtract(3, dadate, " ") day=StrCat(wkday, " ", date) ; Grab the users name for display in the dialog box. user= Environment("USER") varytextFormat=`WWWDLGED,5.0` varytextCaption=`Varying Text Example` varytextX=110 varytextY=78 varytextWidth=119 varytextHeight=64 varytextNumControls=6 varytext01=`38,16,48,DEFAULT,VARYTEXT,user,"xxx"` varytext02=`4,46,48,DEFAULT,PUSHBUTTON,DEFAULT,"YES",1` varytext03=`0,16,36,DEFAULT,STATICTEXT,DEFAULT," Hi "` varytext04=`8,30,100,DEFAULT,STATICTEXT,DEFAULT,"Do you wish to run setup now?"` varytext05=`60,46,48,DEFAULT,PUSHBUTTON,DEFAULT,"NO",0` varytext06=`59,1,56,DEFAULT,VARYTEXT,date,"day"` ButtonPushed=Dialog("varytext")
wbtfiles="C:\WINBATCH\*.WBT"
This box can be tied with the variable to an Edit Box or to Varying Text. When the user chooses a file, it will be displayed in the Edit Box. Varying Text will display the actual variable. For multiple selections or to display pre-defined lists, use the Dialog Editor's Item Listbox option.
Note: When File Listbox is used, the dialog editor assumes that a file must be chosen before it proceeds. Add the following WIL command to the top of your script if you wish to allow the dialog to proceed without a file selection. IntControl(4, 0,0,0,0)
When no file is selected, the return value of the filename variable is: "NOFILESELECTED"
For more information on IntControl, see the Windows Interface Language manual or on-line WIL help file.
In the example code below, notice that the variable 'wbtfiles' is used for the control attributes Varying Text, Edit Box and File Listbox.
wbtfiles="C:\WINBATCH\*.WBT" filelistFormat=`WWWDLGED,5.0` filelistCaption=`File Listbox Example` filelistX=184 filelistY=50 filelistWidth=105 filelistHeight=120 filelistNumControls=6 filelist01=`8,24,84,DEFAULT,VARYTEXT,wbtfiles,"xxx"` filelist02=`4,102,44,DEFAULT,PUSHBUTTON,DEFAULT,"YES",1` filelist03=`8,54,65,43,FILELISTBOX,wbtfiles,DEFAULT` filelist04=`8,8,84,DEFAULT,STATICTEXT,DEFAULT,"Select a file from the list."` filelist05=`54,102,44,DEFAULT,PUSHBUTTON,DEFAULT,"NO",0` filelist06=`8,38,51,DEFAULT,EDITBOX,wbtfiles,"ooo"` ButtonPushed=Dialog("filelist") Message("File Selected", wbtfiles)
Set a variable to display a list of items. Use @tab, a predefined constant, as the delimiter.
tunes="My Shirona%@tab%In the Mood%@tab%Staying Alive%@tab% RockLobster%@tab%Tequila"By default, the ItemSelect Listbox allows multiple selections. To disable this feature use IntControl 33.
IntControl(33, 0, 0, 0, 0)For more information on IntControl, see the Windows Interface Language manual or on-line WIL help file.
Dialog (dialog-name)
(s) dialog-name name of the dialog box.
(i) value of the pushbutton used to close the dialog box.
Note: The DialogEditor has been included to create your dialogs. The following information is for technical reference only. The text which follows describes how to define a dialog box for use by the Dialog function. Please refer to your product-specific documentation for any additional information which may supplement or supersede that which is described here.
Before the Dialog function is called, you must include a section of code in your WIL program which will define the characteristics of the dialog box to be displayed. First of all, the dialog must be declared, and a name must be assigned to it. This is done with a line of the following format:
whereFormat="WWWDLGED,5.0"
Next, the format of the dialog box is defined, as follows:
where:X= Caption=" " Y= Width= Height= NumControls=
Finally, you will need to define the objects, or controls, which will appear inside the dialog box. Each control is defined with a line of the following format:is the internal name of the dialog box, as described above. is the text which will appear in the title bar of the dialog box. is the horizontal coordinate of the upper left corner of dialog box. is the vertical coordinate of the upper left corner of the dialog box. is the width of the dialog box. is the height of the dialog box. is the total number of controls in the dialog box (see below).
where:nn=`x,y,width,height,type,var,"text",value`
nn is the ordinal position of the control in the dialog box (starting with 1).There are eight types of controls available:is the name of the dialog box, as described above. x is the horizontal coordinate of the upper left corner of the control. y is the vertical coordinate of the upper left corner of the control. width is the width of the control. height is the height of the control. [This should be DEFAULT for all controls except file-list boxes and item boxes.] type is the type of control, (see below). var is the name of the variable affected by the control. text is the description which will be displayed with the control. [Use a null string ("") if the control should appear blank.] value is the value returned by the control. [Use only for pushbuttons, radiobuttons, and checkboxes.] Note: should be within the range of 0 - 127. Note: The numbers used for "x-origin", "y-origin", "box-width", "box-height", "x", "y", "width," and "height" are expressed in a unit of measure known as "Dialog Units." Basically speaking: 1 width unit = 1/4 width of system font. 1 height unit = 1/8 height of system font. 4 units wide = Average width of the system font. 8 units high = Average height of the system font.
PUSHBUTTON
A button, which can be labeled and used as desired. When the user presses a pushbutton, the Dialog function will exit and
will return the "value" assigned to the button which was pressed. Therefore, you should assign a unique "value" to each pushbutton
in a dialog. Pushbuttons with values of 0 and 1 have special meaning. If the user presses a pushbutton which has a value of 0,
the WIL program will be terminated (or will go to the label marked ":CANCEL", if one is defined); this corresponds to the behavior
of the familiar Cancel button. A pushbutton with a value of 1 is the default pushbutton, and will be selected if the user presses
the Enter key; this corresponds to the behavior of the familiar OK button. For pushbuttons, "var" should be DEFAULT.
Note: Every dialog box must contain at least one pushbutton.
RADIOBUTTON
One of a group of circular buttons, only one of which can be "pressed" (filled in) at any given time. You can have more than one
group of radiobuttons in a dialog box, but each group must use a different "var". When the Dialog function exits, the value of
"var" will be equal to the "value" assigned to the radiobutton which is pressed. Therefore, you should assign a unique "value"
to each radiobutton in a group. Normally, when a dialog box opens, the default radiobutton in each group (i.e., the one which is
pressed) is the first radiobutton, 'called' in each group. You can change this by assigning a default "value" to the "var" before
calling the Dialog function.
CHECKBOX
A square box, in which an "X" appears when selected. A check box can have a value of 0 (unchecked) or 1 (checked). Each checkbox
in a dialog should use a unique "var". Normally, when a dialog box opens, every checkbox defaults to being unchecked. You can
change this by assigning a value of 1 to "var" before calling the Dialog function.
Note for advanced users only: it is possible to define a group of checkboxes which have the same "var". Each box in the group must have a unique value, which must be a power of 2 (1, 2, 4, etc.). The user can check and uncheck individual checkboxes in the group, and when the Dialog function exits the value of "var" will be equal to the values of all the checkboxes in the group, combined using the bitwise OR operator (|).
EDITBOX
A box in which text can be typed. Whatever the user types in the editbox will be assigned to the variable "var". Normally,
when a dialog box opens, editboxes are empty. You can change this by assigning a value to the string variable "var" before
calling the Dialog function, in which case the value of "var" will be displayed in the editbox.
Note: Variable names that begin with "PW_", will be treated as password fields causing asterisks to be echoed for the actual characters that the user types.
STATICTEXT
Descriptive text, which does not change. This can be used to display titles, instructions, etc. For static text controls,
"var" should be DEFAULT.
VARYTEXT
Variable text. The current value of "var" is displayed. If "var" is not assigned a value in the WIL program before
calling the Dialog function, the "text" field of the control definition will be used.
ITEMBOX
A selection list box. The variable "var" is assumed to contain a tab delimited list. The list is loaded into the list box in the
original order (Use the ItemSort function if a sorted list is desired.). The user may choose none, one, or more items in the list.
When the dialog box is closed, the selected items are returned via the "var" variable as a tab delimited list. If the user selects
more than 99 items, an error will occur.
FILELISTBOX
A file selection list box. This will allow the user to select a file from any directory or drive on the system. The value
of "var" will be set to the selected filename; if you need to know what directory the file is in, use the DirGet function
after the Dialog function exits. Normally, when a dialog box opens, filelist boxes display files matching a filemask of "*.*"
(i.e., all files). You can change this by assigning a different filemask value to the string variable "var" before calling the
Dialog function. Normally, if a dialog contains a filelistbox, you must select a file from the list box before you can exit the
dialog. You can change this behavior by placing the statement IntControl(4, 0, 0, 0, 0) anywhere in your WIL program prior
to the Dialog statement. In combination with the filelistbox, you can include an EDITBOX control which has the same "var" name as
the filelistbox. If you do, the user can type a filemask into the editbox (e.g., "*.TXT"), which will cause the filelistbox to be
redrawn to display only those files which match the specified filemask. Also in combination with the filelistbox, you can include a
VARYTEXT control which has the same "var" name as the filelistbox. If you do, this control will show the name of the directory
currently displayed in the filelistbox. For filelistboxes, "text" should be DEFAULT.
Note: You can have only one filelistbox in a dialog.
You can have a maximum of 100 controls in a dialog.
; Define the dialog format EditFormat=`WWWDLGED,5.0` EditCaption=`Edit INI File` EditX=80 EditY=40 EditWidth=150 EditHeight=170 EditNumControls=14 Edit01=`5,3,40,DEFAULT,STATICTEXT,DEFAULT,"&Directory:"` Edit02=`42,3,100,DEFAULT,VARYTEXT,editfile,""` Edit03=`5,15,80,DEFAULT,EDITBOX,editfile,""` Edit04=`5,30,40,DEFAULT,STATICTEXT,DEFAULT,"&File:"` Edit05=`5,43,80,125,FILELISTBOX,editfile,DEFAULT` Edit06=`98,17,44,DEFAULT,CHECKBOX,backup,"Make &BAK",1` Edit07=`98,40,40,DEFAULT,RADIOBUTTON,state,"No&rmal",1` Edit08=`98,52,40,DEFAULT,RADIOBUTTON,state,"&Zoomed",2` Edit09=`98,64,40,DEFAULT,RADIOBUTTON,state,"&Iconized",3` Edit10=`95,82,44,DEFAULT,PUSHBUTTON,DEFAULT,"&Notepad",1` Edit11=`95,98,44,DEFAULT,PUSHBUTTON,DEFAULT,"&WinEdit",2` Edit12=`95,114,44,DEFAULT,PUSHBUTTON,DEFAULT,"Wri&te",3` Edit13=`95,130,44,DEFAULT,PUSHBUTTON,DEFAULT,"WinW&ord",4` Edit14=`91,151,52,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0` editfile = "*.INI" ; Set default mask for filelistbox backup = 1 ; Set the checkbox to be on by default state = 2 ; Set the 2nd radio button as the default ; Display the dialog, and wait for the user to press one of the ; pushbuttons. The variable "retval" will be equal to the value of ; whichever pushbutton is pressed. while @TRUE retval = Dialog("Edit") ; If the user didn't select a valid file, re-display the dialog If FileExist(editfile) Then break endwhile ; Find out if the checkbox was checked, and proceed accordingly If backup == 1 bakfile = StrCat(FileRoot(editfile), ".BAK") FileCopy(editfile, bakfile, @TRUE) endif ; Find out which radio button was pressed, and set the variable ; "runcmd" to the name of the appropriate member of the Run "family" Switch state case 1 runcmd = "Run" break case 2 runcmd = "RunZoom" break case 3 runcmd = "RunIcon" break endswitch ; Set the variable "editor", based on the pushbutton that was pressed Switch retval case 1 editor = "notepad.exe" break case 2 editor = "c:\win\edit\winedit.exe" break case 3 editor = "write.exe" break case 4 editor = "c:\word\winword.exe" break endswitch ; Execute the appropriate command (using variable substitution) %runcmd%(editor, editfile) Exit :cancel ; If we got here, it means the user pressed the Cancel pushbutton Message(EditCaption, "Operation cancelled")
Article ID: W15120
File Created: 2012:05:24:15:23:48
Last Updated: 2012:05:24:15:23:48