Try not to laugh too hard, please, I know the stuff posted below doesn't compile and is riddled with errors. I don't have much in the way of progamming experience and I've spent the last day trying to read various references, sample scripts, posts and help files I could find and am not getting far. I have commented with some questions and a flow trying to explain what I want, I know I am missing some fundamental syntaxes and understanding of how
to do this. I'm still trying to get a better grasp of strings, if statements and how to tie actions to a dialog button. I've got the scripts I am trying to spawn working, I just want to tie it all together to a simple dialog so end users can use it with no fundamental understanding of Procomm.
What I've tried to do is outline enough of what I am wanting to do so that someone can help me with some better examples to make it do what I need - or if I could find an example of a dialog script that uses a few string and lists and then spawns some scripts inserting those strings based on different buttons pressed I might be able to get it to where I need.
; This script and related dialog box is used to select 3 variables -
; Router, Profile & MAC or EndOfMAC
; MAC/EndOfMAC string can be manually typed or pulled from clipboard using cliptostr
; If MAC entered manually it gets put back in clipboard
; with strtoclip for sub scripts to pull string and use it.
; then two buttons (UpdateProfile, ResetModem) use those three variable strings to invoke
; telnet sessions in same or a child window session. Third button EXIT exits Dialog Box and may
; want to close the pw5 session or leave it open, not sure
; but I'll probably want to do a version of the dialog or add a check box to close Procomm when exiting.
; UpdateProfile or ResetModem initiates telnet session using entry from dialing directory,
; this uses default script from Dialiing Directory to login. Then telnet needs to
; execute a script based on selection (UpdateProfile, ResetModem) passed from dialog box.
; This invoked script will need to pull Profile to
; determine script used and NAC/EndofMAC for data used in
; sub-scripts to reset modem or update profile.
; General question on text edit String MAC from dialog - do I need to use
; dlgevent somewhere to update string MAC from edit box?
; I probably want to be checking for any new string there as the user may
; process one string then multiple other strings.
proc main
string RouterList
string Router ="Abbotts,Ashbrook,Legacy,Jacksonville,SpringForest,Wilmington,Woodland"
string ProfileList
string Profile ="Deactivated,Basic,Express,Turbo"
string MAC
string EndOfMAC
cliptostr EndOfMAC
setaspect spawn ON ;allows script to spawn scripts
set dialentry scriptstart CONNECTED
dialogbox 0 68 22 218 142 2 "Modem Config Tool"
text 10 150 2 54 9 "Select Profile" left
text 11 41 2 50 9 "Select Router" left
listbox 12 18 13 94 73 RouterList SINGLE Router sort
text 13 6 95 126 12 "Enter MAC Address in format XX.XXXX" left
text 14 32 109 143 12 "Leave MAC empty to use Windows Clipboard" left
editbox 15 133 92 56 13 MAC 7
text 18 169 120 49 11 EndOfMAC left ; show string taken from cliptostr if any
pushbutton 19 128 34 84 12 "Update Modem Profile" ok default
pushbutton 20 132 53 78 13 "Reset Modem"
pushbutton 21 75 125 58 13 "Exit"
listbox 42 132 13 78 12 ProfileList SINGLE Profile
enddialog
;;;;;;; SELECT WHICH BUTTON WAS PRESSED
switch WhichButton ; Evaluate the WhichButton variable
if case 19
; UpdateProfile pressed,
; I think I have button label correct, do I?
call UpdateProfile
if case 20 ;ResetModem pressed
call ResetModem
if case 21 ;Exit pressed
call Exit
endcase
endswitch
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; do I need to do a proc to Exit Dialog or just use something like
; dlgdestroy 0 CANCEL ; to Destroy the dialog under case 21 above
; on exit I want to leave last connected session still connected,
; or possibly close entire Procomm session
endproc ; end main proc
;;;;;;;UPDATE PROFILE FUNCTION;;;;;;;;;;;;;;;;;;;;;;;;
proc UdpateProfile
; if MAC was entered manually
; copy MAC string to clipboard and EndOfMAC
; I could do this other ways but have scripts already
;set to use EndOfMAC string from clipboard, this lets me
;use same scripts. Wasn't sure if the spawned scripts will
;use strings from the parent script - using clipboard I
;can do what I need without dealing with DDE and multiple
;sessions of procomm.
if EndofMAC="" ; if clipboard empty fill with MAC string
strtoclip MAC
; if EndOfMAC is populated leave it alone. It'd be nice to validate clipboard has format "XX.XXXX" and to string any trailing <CR> here too if I can.
usermsg "Connecting to site"
; I want to use 'usermsg "Connecting to %s" Router' - I'm not clear if that will work using string
; from main script or if I need to define the string in some way in sub-routine also.
dial TELNET "Router"
;normally I invoke directory entry with
; 'dial TELNET "Abbotts"' - if I am using Router string to
; get my Directory entry does Router need to be in quotes or how do I use Router string here?
while $DIALING
yield
endwhile
; spawn Profile script (Basic, Express, Turbo,
; Deactivated) using Profile set in dialog
execute Profile
usermsg "Profile Updated"
edproc
;;;;;;;;;RESET MODEM FUNCTION;;;;;;;;;;;;;;;;;;;;;;;;
proc ResetModem
; if use EndOfMAC from clipboard was not selected copy text entry MAC to clipboard
if EndofMAC=""
strtoclip MAC
; MAC format is upper case, reset needs string to be in lower case
strlower EndofMac
usermsg "Connecting to site"
; can I include String Router, i.e.e usermsg "Connecting to Router" to ID router here?
dial TELNET "Router"
while $DIALING
yield
endwhile
execute ClipReset ; clipReset script pulls strtoclip to execute reset
usermsg "Reset completed"
endproc
;;;;;;;;;;;;;;;;EXIT - NOT SURE WHAT I NEED TO DO TO MAKE EXIT BUTTON EXIT DIALOG
;not sure I even need to do this as a proc or as part of
; the WUD dialog area
Thanks for any assistance, sample scripts, corrections or suggestion you may be able to offer.
to do this. I'm still trying to get a better grasp of strings, if statements and how to tie actions to a dialog button. I've got the scripts I am trying to spawn working, I just want to tie it all together to a simple dialog so end users can use it with no fundamental understanding of Procomm.
What I've tried to do is outline enough of what I am wanting to do so that someone can help me with some better examples to make it do what I need - or if I could find an example of a dialog script that uses a few string and lists and then spawns some scripts inserting those strings based on different buttons pressed I might be able to get it to where I need.
; This script and related dialog box is used to select 3 variables -
; Router, Profile & MAC or EndOfMAC
; MAC/EndOfMAC string can be manually typed or pulled from clipboard using cliptostr
; If MAC entered manually it gets put back in clipboard
; with strtoclip for sub scripts to pull string and use it.
; then two buttons (UpdateProfile, ResetModem) use those three variable strings to invoke
; telnet sessions in same or a child window session. Third button EXIT exits Dialog Box and may
; want to close the pw5 session or leave it open, not sure
; but I'll probably want to do a version of the dialog or add a check box to close Procomm when exiting.
; UpdateProfile or ResetModem initiates telnet session using entry from dialing directory,
; this uses default script from Dialiing Directory to login. Then telnet needs to
; execute a script based on selection (UpdateProfile, ResetModem) passed from dialog box.
; This invoked script will need to pull Profile to
; determine script used and NAC/EndofMAC for data used in
; sub-scripts to reset modem or update profile.
; General question on text edit String MAC from dialog - do I need to use
; dlgevent somewhere to update string MAC from edit box?
; I probably want to be checking for any new string there as the user may
; process one string then multiple other strings.
proc main
string RouterList
string Router ="Abbotts,Ashbrook,Legacy,Jacksonville,SpringForest,Wilmington,Woodland"
string ProfileList
string Profile ="Deactivated,Basic,Express,Turbo"
string MAC
string EndOfMAC
cliptostr EndOfMAC
setaspect spawn ON ;allows script to spawn scripts
set dialentry scriptstart CONNECTED
dialogbox 0 68 22 218 142 2 "Modem Config Tool"
text 10 150 2 54 9 "Select Profile" left
text 11 41 2 50 9 "Select Router" left
listbox 12 18 13 94 73 RouterList SINGLE Router sort
text 13 6 95 126 12 "Enter MAC Address in format XX.XXXX" left
text 14 32 109 143 12 "Leave MAC empty to use Windows Clipboard" left
editbox 15 133 92 56 13 MAC 7
text 18 169 120 49 11 EndOfMAC left ; show string taken from cliptostr if any
pushbutton 19 128 34 84 12 "Update Modem Profile" ok default
pushbutton 20 132 53 78 13 "Reset Modem"
pushbutton 21 75 125 58 13 "Exit"
listbox 42 132 13 78 12 ProfileList SINGLE Profile
enddialog
;;;;;;; SELECT WHICH BUTTON WAS PRESSED
switch WhichButton ; Evaluate the WhichButton variable
if case 19
; UpdateProfile pressed,
; I think I have button label correct, do I?
call UpdateProfile
if case 20 ;ResetModem pressed
call ResetModem
if case 21 ;Exit pressed
call Exit
endcase
endswitch
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; do I need to do a proc to Exit Dialog or just use something like
; dlgdestroy 0 CANCEL ; to Destroy the dialog under case 21 above
; on exit I want to leave last connected session still connected,
; or possibly close entire Procomm session
endproc ; end main proc
;;;;;;;UPDATE PROFILE FUNCTION;;;;;;;;;;;;;;;;;;;;;;;;
proc UdpateProfile
; if MAC was entered manually
; copy MAC string to clipboard and EndOfMAC
; I could do this other ways but have scripts already
;set to use EndOfMAC string from clipboard, this lets me
;use same scripts. Wasn't sure if the spawned scripts will
;use strings from the parent script - using clipboard I
;can do what I need without dealing with DDE and multiple
;sessions of procomm.
if EndofMAC="" ; if clipboard empty fill with MAC string
strtoclip MAC
; if EndOfMAC is populated leave it alone. It'd be nice to validate clipboard has format "XX.XXXX" and to string any trailing <CR> here too if I can.
usermsg "Connecting to site"
; I want to use 'usermsg "Connecting to %s" Router' - I'm not clear if that will work using string
; from main script or if I need to define the string in some way in sub-routine also.
dial TELNET "Router"
;normally I invoke directory entry with
; 'dial TELNET "Abbotts"' - if I am using Router string to
; get my Directory entry does Router need to be in quotes or how do I use Router string here?
while $DIALING
yield
endwhile
; spawn Profile script (Basic, Express, Turbo,
; Deactivated) using Profile set in dialog
execute Profile
usermsg "Profile Updated"
edproc
;;;;;;;;;RESET MODEM FUNCTION;;;;;;;;;;;;;;;;;;;;;;;;
proc ResetModem
; if use EndOfMAC from clipboard was not selected copy text entry MAC to clipboard
if EndofMAC=""
strtoclip MAC
; MAC format is upper case, reset needs string to be in lower case
strlower EndofMac
usermsg "Connecting to site"
; can I include String Router, i.e.e usermsg "Connecting to Router" to ID router here?
dial TELNET "Router"
while $DIALING
yield
endwhile
execute ClipReset ; clipReset script pulls strtoclip to execute reset
usermsg "Reset completed"
endproc
;;;;;;;;;;;;;;;;EXIT - NOT SURE WHAT I NEED TO DO TO MAKE EXIT BUTTON EXIT DIALOG
;not sure I even need to do this as a proc or as part of
; the WUD dialog area
Thanks for any assistance, sample scripts, corrections or suggestion you may be able to offer.