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!

Scripts that ask and then get info based on answers

Status
Not open for further replies.

bmcken

Technical User
Oct 27, 2003
4
US
I was wondering if it's possible to have a script ask a question and then based on the answer pull several lines of text into the currently running script before continuing on.

an example would be something like:

Proc main
transmit "set id `"Metrocom`^M"
waitfor ">"
transmit "connect a:1:1-8 1:1-8^M"
waitfor ">"
transmit "connect a:1:17-24 6:1:1^M"
waitfor ">"

at this point I would like the script to ask:
"Are there any DID's?"
if the answer is yes I would like the script to call up a text file that enters the following:
If the answer is no it should continue on without calling the alternate section of text.

transmit "set a:1:9-16 signal emi^M"
waitfor ">"
transmit "set 4:1-8 signal dpt^M"
waitfor ">"
transmit "connect a:1:9-16 4:1-8^M"

then when that is done it would continue on or do the same thing at another point with another question and result.

The above additional text would more than likely be a text file to upload or read all lines from.

Thanks in advance for any help...
 
You could display a dialog box with two radio buttons and a push button. The user would select one of two radio buttons (called Yes or No for instance), which would be stored in the radiogroup variable. Your script would then have an if statement checking the value and either send the extra commands or not. If you look at the discussion of the radiogroup command in the ASPECT help file, there is an example that should get you started.


aspect@aspectscripting.com
 
Sounds to me like you should use an if statement
possibly something like this:

integer YESS = 0
integer DID
string sDID = "N"
...
sdlginput "DID Present Input" "Input Y if DID present: " sDID DEFAULT
strlwr sDID
strcmp sDID "y" DID

if (DID == YESS)
transmit "set a:1:9-16 signal emi^M"
waitfor ">"
transmit "set 4:1-8 signal dpt^M"
waitfor ">"
transmit "connect a:1:9-16 4:1-8^M"
endif


I am not familiar with your switch but you may very well be able to automate what you are doing by having the script to determine if there are any DID's without requiring the user input. Of course you can always use the fancy buttons or the like instead of text prompt via the sdlginput command.

And you could process lines from an external file instead of the hard coded script lines etc.

Hope this helps, good luck, DT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top