Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialogbox Questions 1

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
Help, I am writing a script that uses a Dialog box with Multiple selections. I have Grouped all of my buttons, but now I need to get started. First at least one selection must be made for each Group.

The First Group "Data FOLDER Group Name" I want to reference the Sub Folders In the current Connection Directory.

The Second Group "Password" Will decide if the password Generated for each site is Random or Listed. If Listeed is Selected then the Edit box below in Not Greyed out and text can be entered.

The Third Group "Logon Select" This allows the script to select which password will be changed (i.e., if Sysadmin is selected a Script called Sysadmin runs) Note this will reference the number from teh Fourth Group.

The Fourth Group "Password Length" This will decide how long the password should be 6,8, or 10 digits (script is already written PswdLength.wax).

dialogbox 0 218 121 238 199 2 " PhoneMail Password Changer Ver 5.4"
groupbox 3 13 2 214 36 "Data Group Name"
flistbox 4 23 17 182 13 "items.lst" SINGLE SelectVar1
; FNameVar1 = ProComm Directory Name
; SelectVar1 = Folder selected in Directory
; flistbox 4 22 17 182 13 FNameVar1 SINGLE SelectVar1
groupbox 5 14 52 102 71 "Password"
radiogroup 16 iVar1
radiobutton 6 27 68 74 11 " Random"
radiobutton 7 27 86 70 11 " Listed"
endgroup
editbox 8 27 104 80 12 eVar1
groupbox 9 121 52 106 70 "Login Select"
checkbox 10 126 69 86 11 "Sysadmin" IntVar3
checkbox 11 126 87 98 11 " TECH (Set to DEFAULT)" IntVar4
checkbox 12 126 104 88 11 " TECH 2nd Lvl" IntVar5
pushbutton 13 26 174 53 14 "Run"
pushbutton 14 94 174 53 14 "View Last"
pushbutton 15 162 174 53 14 "&Exit"
groupbox 17 12 132 214 29 "Password Length"
checkbox 18 30 146 57 9 " 6-Digits" IntVar6
checkbox 19 99 146 44 11 " 8-Digits" IntVar8
checkbox 20 162 144 46 13 " 10-Digits" IntVar10
enddialog


any assistance will be appreciated.

Here are my Questions.
 
What you will need to do is have a while loop after the dialog box has been displayed to check for any dialog events and then process those as they come in. If you look at the discussion of the dirlistbox command in the ASPECT help file, it has a good example script showing how to do this.

I'm not certain if it's possible to get the name of each group from the Connection Directory. It did not appear immediately obvious to me at first glance.

For the password group box, you would want to use the disable command to grey out the edit field until someone clicks the Listed radiobutton and then enable it at that point. In this case it would be disable DLGCTRL 0 8 to turn it off (would want to do this after the enddialog command and enable DLGCTRL 0 8 to turn it back on. This command would be in the while loop handling your dialog events, under ID 7 in the switch/case statements. You would want to check the value of iVar1 and enable the edit field if it was set to 7.

For the Login Select group, you may want to change those to radiobuttons, will be a bit easier to check and you don't have to worry about someone making more than one selection. I'm assuming the same change could be made for the Password Length checkboxes as well.

 
I know there is a way to display the Groups from a Dialing directory in a box. I have a compiled script that does it, I just don't have the uncompiled version.

Basically I have a Directory PhoneDialer.dir with 2 groups:
the first is SWITCHES, the second is VOICEMAILS. The number and Names of the groups chage dependind on the Connection Directory that is in use. I want to be able to diaplay these in Dropdown box for user selection.

Once they are selected the script will dial all entries in this group only.

You help would be greatly appreciated.
 
Knob,

He is the Script I have so far. Needles to say the fListBox (4) still does not work. This all ties in with the script you helped me write for password (Letter-Number-Letter-number, etc.).

#define WorkDir "C:\Temp Data Files\Raw Data\"
proc main
string cDirPath = "C:\Program Files\Symantec\Procomm Plus\"
string aPath = "C:\Temp Data Files\Raw Data"
string aDir = "C:\Temp Data Files\Raw Data\"
string aProg, aFile
string Letter, Pswd, NumNum, LtrNum, Selectvar1, eVar1
integer x, y, Event
integer IntVar3, IntVar4, IntVar5, IntVar6, IntVar8, IntVar10, Ivar1
integer nNumber, lNumber, iLoop ; Random number.
integer nSeed, lseed ; Seed for better randomization.


dialogbox 0 193 54 238 199 2 " PhoneMail Password Changer Ver 5.4"
groupbox 3 7 2 220 36 "Data FOLDER Group Name"
flistbox 4 23 17 182 13 "items.lst" SINGLE SelectVar1
groupbox 5 6 52 110 71 "Password"
radiogroup 16 iVar1
radiobutton 6 12 68 97 11 " Randomly Generated"
radiobutton 7 12 86 97 11 " Enter Password Below: "
endgroup
editbox 8 12 104 96 12 eVar1
groupbox 9 121 52 106 70 "Login Select"
checkbox 10 126 69 86 11 " Sysadmin" IntVar3
checkbox 11 126 86 98 11 " TECH (Set to DEFAULT)" IntVar4
checkbox 12 126 104 88 11 " TECH 2nd Lvl" IntVar5
pushbutton 13 26 174 53 14 "Run"
pushbutton 14 94 174 53 14 "View Last"
pushbutton 15 162 174 53 14 "&Exit"
groupbox 17 6 132 220 29 "Password Length"
checkbox 18 30 146 57 9 " 6-Digits" IntVar6
checkbox 19 99 146 44 11 " 8-Digits" IntVar8
checkbox 20 162 144 46 13 " 10-Digits" IntVar10
enddialog
disable DLGCTRL 0 8
while 1
dlgevent 0 Event
switch Event
case 0
endcase
case 1
disable DLGCTRL 0 0
endcase
case 16
enable DLGCTRL 0 8
disable DLGCTRL 0 6
dlgupdate 0 8
; disable DLGCTRL 0 7
endcase
case 10
disable DLGCTRL 0 11
disable DLGCTRL 0 12
endcase
case 11
disable DLGCTRL 0 6
disable DLGCTRL 0 10
disable DLGCTRL 0 12
disable DLGCTRL 0 18
disable DLGCTRL 0 19
disable DLGCTRL 0 20
endcase
case 12
disable DLGCTRL 0 10
disable DLGCTRL 0 11
endcase
case 14
aProg = "NOTEPAD.exe"
strcpy aDir aFile
strcpy aProg aDir
chdir WorkDir
run aProg
endcase
case 15
exit
endcase
case 18
x = 6
disable DLGCTRL 0 19
disable DLGCTRL 0 20
endcase
case 19
x = 8
disable DLGCTRL 0 18
disable DLGCTRL 0 20
endcase
case 20
x = 10
disable DLGCTRL 0 18
disable DLGCTRL 0 19
endcase
default
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL
y = x/2

for iLoop = 1 upto y
rand nSeed ; Get a random integer.
rand nNumber nSeed ; Get random integer with seed.
nNumber = nNumber % 10 ; Convert random number to a number between 0 and 9.
itoa nNumber NumNum
strcat Pswd NumNum

rand lSeed ; Get a random integer.
rand lNumber lSeed ; Get random integer with seed.
lNumber = lNumber % 27 ; Convert random number to a number between 0 and 27.
switch lNumber ; Find value of numeric variable
case 0 ; and display corresponding Letter
Letter = "A"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 1
Letter = "B"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 2
Letter = "C"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 3
Letter = "D"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 4
Letter = "E"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 5
Letter = "F"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 6
Letter = "G"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 7
Letter = "H"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 8
Letter = "I"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 9
Letter = "J"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 10
Letter = "K"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 11
Letter = "L"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 12
Letter = "M"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 13
Letter = "N"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 14
Letter = "O"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 15
Letter = "P"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 16
Letter = "Q"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 17
Letter = "R"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 18
Letter = "S"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 19
Letter = "T"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 20
Letter = "U"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 21
Letter = "V"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 22
Letter = "W"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 23
Letter = "X"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 24
Letter = "Y"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
case 25
Letter = "Z"
itoa lNumber LtrNum
strcat Pswd Letter
endcase
endswitch
endfor
usermsg "The New Password is %s." Pswd
endproc

 
Knob,

The only onther part I am working on (besides putting it all together), is the TECH (set to Default button). I have deactivated all the uneeded controls. Is there some way to Select the Radiobutton (7) automatically , so the Editebox (8) is available for the new Default password to be typed in.

Since alot of the people who use this script will probably forget how, I want as much automated as possible.

Your help and guidance is as always appreciated.
 
If you update the below line in your script, it will turn on the checkbox and set the radio button:

integer IntVar3, IntVar4 = 1, IntVar5, IntVar6, IntVar8, IntVar10, Ivar1 = 7

 
Knob,

Thanks for your last post I changed it and now that portion works.

as to the fListbox would it work If I exported the directory and used the exported version to populate the listbox as well as run the script. Then upon completion update the directory?

Just a thought?
 
Knob,

HAve you had a chance to look at the Groiup issue I am having?

I know there is a way to display the Groups from a Dialing directory in a box. I have a compiled script that does it, I just don't have the uncompiled version.

Basically I have a Directory PhoneDialer.dir with 2 groups:
the first is SWITCHES, the second is VOICEMAILS. The number and Names of the groups chage dependind on the Connection Directory that is in use. I want to be able to diaplay these in Dropdown box for user selection.

Once they are selected the script will dial all entries in this group only.


Any assistance you can provide will be greatly appreciated.
 
Sorry about that, appears I forgot about this. The below code will go through and get the number of entries for your two Connection Directory groups, then iterate through both groups and get all of the entry names. Depending on how many entries you have, you could either write the values to a text file and read that in, or append to a comma-delimited file (think that is the proper format) and use that string in your dialog.

Code:
proc main
   integer NumEnts                     ; Used to count entries.
   integer Count                       ; Used for loop.
   string EntName                      ; Name of directory entry.

   dialcount DATA GROUP "SWITCHES" NumEnts      ; Get number of DATA entries.
   for Count = 0 upto (NumEnts - 1)    ; dialname zero-based.
      dialname DATA GROUP "SWITCHES" Count EntName    ; Get name of entry.
      usermsg "%s" EntName
   endfor
   dialcount DATA GROUP "VOICEMAIL" NumEnts      ; Get number of DATA entries.
   for Count = 0 upto (NumEnts - 1)    ; dialname zero-based.
      dialname DATA GROUP "VOICEMAIL" Count EntName    ; Get name of entry.
      usermsg "%s" EntName
   endfor
endproc

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top