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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help setting modem connections with a user input dialog 1

Status
Not open for further replies.

NeoValence

Technical User
Mar 21, 2006
35
US
Hi All,

I'm new to scripting so please excuse the new-b question.

I need to set two modem connections using the users input from a dialog i created using the dlg editor. The problem seems to be variables to make it all happen. This is what i'v come up with so far.

proc main
dlg0()
uuttrm()
;uut setup commands
dlg1()
iprotrm()
;ipro setup commands
endproc



proc dlg0
dialogbox 0 264 97 305 46 2 "Com Port Setup"
radiogroup 1 var
radiobutton 4 2 20 35 19 "Com1"
radiobutton 21 39 20 35 19 "Com2"
radiobutton 22 79 20 35 19 "Com3"
radiobutton 23 117 20 35 19 "Com4"
radiobutton 24 155 21 35 19 "Com5"
radiobutton 25 193 21 35 19 "Com6"
radiobutton 27 231 21 35 19 "Com7"
radiobutton 28 268 21 35 19 "Com8"
endgroup
text 26 0 8 305 11 "Which COM Port is your UUT using?" center
enddialog
endproc

proc dlg1
dialogbox 0 264 97 305 46 2 "Com Port Setup"
radiogroup 1 var
radiobutton 4 2 20 35 19 "Com1"
radiobutton 21 39 20 35 19 "Com2"
radiobutton 22 79 20 35 19 "Com3"
radiobutton 23 117 20 35 19 "Com4"
radiobutton 24 155 21 35 19 "Com5"
radiobutton 25 193 21 35 19 "Com6"
radiobutton 27 231 21 35 19 "Com7"
radiobutton 28 268 21 35 19 "Com8"
endgroup
text 26 0 8 305 11 "Which COM Port is your I-Pro using?" center
enddialog
endproc

proc uuttrm
set modem connection
set port baudrate 115200
endproc

proc iprotrm
set modem connection
set port baudrate 34800
endproc

all input will be greatly appreciated.

Thanks in advace
 
Instead of using variables like you have, it might be easier to list the connections on the system and let them choose the proper one from the list. Here is a sample script from a recent project I did that will get all of the modems on a system, display them in a dialog, let the user select one, and then change the current connection to that item. If they also need to be able to access direct connections, comment out the if not strfind/endif block so that those connections get listed as well.

proc main
integer iLoop, iCount, Event
string sName

dialogbox 0 8 20 142 57 3 "Searching Modems"
text 1 8 12 124 26 "Searching for available modem, please wait." center
enddialog
fopen 0 "modems.txt" CREATE TEXT
itemcount MODEM CONNECTION iCount
for iLoop = 0 upto iCount-1
itemname MODEM CONNECTION iLoop sName
if not strfind sName "direct connect-"
fputs 0 sName
endif
endfor
fclose 0
dlgdestroy 0 CANCEL

dialogbox 0 8 20 264 130 31 "Select Modem"
flistbox 1 9 7 246 91 "modems.txt" SINGLE sName HSCROLL SORT
pushbutton 2 101 106 61 18 "OK" DEFAULT
enddialog

while 1
dlgevent 0 Event
switch Event
case 1
endcase
case 2
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 OK

set modem connection sName
endproc

 
knob,

Wow! Thanks alot for the help, and for the quick response. You were right, your script was much less problematic. Once i commented out if/endif lines it worked perfectly for what i need it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top