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!

Allow multiple selections in a list (flist) box

Status
Not open for further replies.

tornateo

Technical User
Apr 22, 2003
3
I currently utilize a small script which allows co workers to telnet to specific devices utilizing an flist box. It was recently expressed to me that users would find value in being able to select multiple devices simultaneously.

Basically... can I use an flist box and allow multiple selections? I need it to open a new session of Procomm with each selection after the first. Can the following script be manipulated to accomodate this?... can this even be done?

string ListItem ; Item selected from list.
integer Event ; Dialog box event.

proc main
dialogbox 0 45 96 100 100 11 "QC"
flistbox 1 5 5 90 80 "S:\tech procedures\Nate\QC41.TXT" SINGLE ListItem
pushbutton 2 28 80 40 14 "OK" ok default
enddialog
while 1
dlgevent 0 Event ; Get the dialog event.
switch Event ; Evaluate the event.

case 0 ; No event occurred.
endcase

case 1 ; Exit button selected
IF strsearch ListItem "BSC25"
connectmanual TELNET "XXX.XXX.XXX.XXX:2100"
login()
ENDIF

IF strsearch ListItem "BSC02"
connectmanual TELNET "XXX.XXX.XXX.XXX:2200"
login()
ENDIF
.
.
.
IF strsearch ListItem "BSC64"
connectmanual TELNET "XXX.XXX.XXX.XXX:2400"
login()
ENDIF


exitwhile
endcase
default ; Exit case chosen.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.
endproc

proc login
transmit "^M"
waitfor "login:"
waitquiet 1
transmit "access^M^M"
waitfor ">"
transmit "disp_dte^M"
PWTITLEBAR ListItem PERMANENT
endproc
 
That wasn't very clear. I just need to be able to select 2 or more items from a list and connect to both at the same time... I'll need a new Procomm window for each new connection beginning with the second...

Thanks again in advance for any advice or assistance... This forum is great!...
 
You can use the MULTIPLE keyword with the flistbox command to save the selected entries to a text file that your script would then parse. You would need to change the flistbox command in your existing script to read:

flistbox 1 5 5 90 80 "S:\tech procedures\Nate\QC41.TXT" MULTIPLE "c:\file.txt"

replacing the dummy filename above with the actual filename you want to use.

In your switch statement, you would just want:

case 1
endcase

since the script processes multiple selections now, and add:

case 2
exitwhile
endcase

so that the script kicks out of the switch structure after the user has clicked the OK button.

Finally, you would open the text file using the fopen and other related commands to read the selected entries line by line, and you should be able to reuse your existing code to launch the appropriate connection.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top