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

IF waitfor "xxx" timeout too long w/ mult. waitfor variables needed

Status
Not open for further replies.

matt1981m

Technical User
Jul 1, 2006
32
US
I have tried many things using aspect scripting in the past few months, and have succeeded in many. Currently, the bane of my existence (a traditionally simple login script for a voicemail system) has culminated into one simple yet surprisingly difficult problem. I have set up this “login script” of mine to select a couple menu options when the main menu appears. To do this I have just used a simple waitfor “xxxx” command. This works correctly. The problem I have is that this voicemail system will often present an error (“ANP register failure”). The user must then close the connection and then re-log back in. What I am trying to do is simplify this task and have my switch close the connection and then dial again as well as reprocess the login before resuming the original script. I have created the script using the following commands…

if waitfor “ANP register failure”
Call anperror
else
Call noerror
endif
endproc

The problem is that if the script encounters the error the first time, it works correctly since you don’t get the error twice. If the login processes correctly and the error doesn’t come up, you have to wait 30 seconds for the waitfor command to timeout.

What I was thinking I needed to do is have the script actively wait for either “ANP register failure” or the main menu at the same time. Once either criteria is met, the script would then process the correct procedure…. I think it would look something like this:

waitfor “ANP register failure” | "^@^@^@^H^H^H^H^H^H^H^H"
if “ANP register failure”
Call anperror
elseif "^@^@^@^H^H^H^H^H^H^H^H"
Call noerror
endif
endproc

This of course, does not work. I was however, able to get it to work using the following commands…

when QUIET 4 call anperror
if waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endif


The finalized script appears as follows. NOTE: I have replaced specific portions of the script with a description of what should be there...i.e. username and password info have been removed..etc.... Also with the system I was accessing, to load a subscribers voicemail box you have to use a specially mapped key and not just the plain old enter key... i have mapped the necessary key sequence to F12 and have used the vkey (0x7B) that references that key...


string ctn
proc main
pwtitlebar "NAME OF VM SYSTEM HERE" PERMANENT
waitfor "login: "
transmit "putusernamehere^M"
waitfor "Password:"
transmit "putpasswordhere^M"
when QUIET 4 call anperror
if waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endif
endproc
proc noerror
when CLEAR
transmit "1^M"
waitfor "^@^@^@"
if sdlginput "ACCESS VOICEMAIL SUBSCRIBER" "PLEASE ENTER CTN:" ctn
if isfile ctn
endif
transmit ctn
endif
sendvkey 0x7B
halt
endproc

proc anperror
HANGUP
dial TELNET "CONNECTION DIRECTORY ENTRY"
waitfor "login: "
transmit "putusernamehere^M"
waitfor "Password:"
transmit "putpasswordhere^M"
waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endproc


 
i was never able to get the waitlist.was to work....i am using Procomm Plus 4.8... when i try to integrate this into any script i get "Error C025 Line 29: Unexpected command: PARAM" as well as multiple other errors... i also cant get the "when QUIET 4 call whatever" to work when integrated in this script... it says "Error C081 Line 19: Invalid number of arguments" for that line...will you take a look at that file and tell me how to get it to run with minimal modifications (i want to make sure it will do what i want it to do...) and is the max target commands three??? or can i use more than 3.... i actually need to "wait" for about 50 different target commands simultaneously.... i know that is a BIG request but i would really like to get this to work....
 
You would copy all of the waitlist.was script and add it to the end of your existing script with the exception of this line:

INTEGER WaitListStat = 0

It must be declared as a global variable, so place it before proc main.

To call the procedure, the format is:

Waitlist(delay, prompt1, prompt2, prompt3)

where delay is the number in seconds to look for the prompts, and each prompt is either enclosed in double quotes or are string variables containing the strings to look for.

However, in your case if you are looking for up to 50 different prompts, you would need to expand the heck out of the waitlist script. I think this would be doable, you would just need to modify the waitlist procedure to add additional when target commands and the corresponding waitlistsN procedures to be called. I don't know if ASPECT will handle 50 when targets gracefully as I've never gone even remotely close to that number.

 
thanks!!!!... i found out it has a max of 15 targets.... anyone else come accross this before, or have any ideas????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top