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

How to pass the "Key Return to continue" prompt 2

Status
Not open for further replies.

dorajychen

Technical User
May 8, 2007
3
0
0
US
Hi, I am a brand new Aspect script user. I am trying to use the recorder to input data from a text file. "Key Return to continue" prompt will come up for some accounts after entering the account number, I don't know how to pass it. Please help. My script looks like the following:

proc main
string sACCOUNT
string sCCODE
string sLinehld

if fopen 0 "C:\Work\Date.txt" READ
while not feof 0
fgets 0 sLinehld
substr sACCOUNT sLinehld 0 5
substr sCCODE sLinehld 6 9
transmit "8.1.01^M"
waitfor "^[[4m"
transmit sACCOUNT
transmit "^M"
waitfor "^[[4m"
;here is the problem encountered
;if waitfor "^[[0mKey RETURN to continue. ^[[0m" ;need to transmit "^M' once and then transmit "1^M"
;else
;transmit "1^M"
;endif
waitfor "^[[4m"
transmit "9000^M"
endwhile
endif
endproc
 
There are a couple ways to handle this depending on the situation. If you are just needing to look for that prompt and send enter, you can use a when target command and in the called procedure use transmit "^M" to automatically proceed.

However, it looks like you may possibly get two different prompts on that page that need to be handled. In that case, another user send me a script a while back that used multiple when target commands to look for multiple strings/prompts and handle whichever one showed up first. I think this is probably the better solution for you. Go to the samples page on my site (link below) and search for Josh to find the discussion of the script. If you use this method, you will need to check the return code from that function to determine which string was received, and then send the necessary command to clear it.

 
Another method is...Test for SUCCESS/FAILURE of the WAITFOR...

waitfor "^[[0mKey RETURN to continue. ^[[0m" 5 ;wait 5 secs
IF SUCCESS
transmit "^M'
ENDIF
transmit "1^M" ;this tx was needed for either case

;if probs persist, you may find it necessary to script a slight pause between the two transmits...
e.g MSPAUSE 250 (250 millisec's) or PAUSE 1 (1sec).
 
thank you so much, knob & comtechau! I have found the waitlist script and it works great! but I still have a problem. I found some accounts have tow messages added and need to hit enter twice (one after another) to pass the prompt. waitlist would work becaue the strings on the terminal are the same "Key RETURN to continue. " Only difference is the position. I am wondering if it is possible that using the cursor position to determin the action... Should I use Array?
 
Dora, To get data from a line in the terminal window.. 'GETCUR' gets current cursor co-ords and 'TERMGETS' to get a specified amount of chars' from a specified row/column. However, as per knobs suggestion, and in my opinion WHEN TARGET would be the best way to handle this.
Code:
proc MAIN 
WHEN TARGET 0 "Key RETURN to continue. " call ENTERSTR
<rest of your script here>
end proc

Proc ENTERSTR
transmit "^M"
endproc

Whenever "Key RETURN to continue. " appears anywhere within the terminal window, your script will call the ENTERSTR procedure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top