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!

File capture cutting off early...

Status
Not open for further replies.

shibby

Programmer
Oct 17, 2002
9
US
Greetings...!

I've got a script that business people use here to pull a report and save the output to a file.

This is the pertinent part of the script:

-----------------------------------------------------------

set capture file name
capture on

waitfor "DEAL DTEý--------............................................."
transmit "N"
waitfor "^[(^[.2^[T^GREPORT COMPLETE. PRESS RETURN TO CONTINUE "
capture off

-----------------------------------------------------------

The problem is, the capture file doesn't show the last few pages of the report. It's like it cuts off before that text is displayed. Is there some nuiance I'm missing? My understanding was that any text that occurred up to and including the "waitfor" text would be included in the capture.
 
What you are probably running into with the waitfor "^[(^[.2^[T^GREPORT COMPLETE. PRESS RETURN TO CONTINUE " command is that the waitfor command will time out after 30 seconds if it doesn't see the string it is seeing. You can increase the timeout value of that command by adding an integer value equal to the number of seconds the waitfor command should look for the string. For example:

waitfor "^[(^[.2^[T^GREPORT COMPLETE. PRESS RETURN TO CONTINUE " 60

will wait 60 seconds for the string and then timeout. You could also use the keyword FOREVER to have the waitfor command never exit until the string was received.

Another thing you might want to do is check the success or failure of the waitfor command in your script, then branch according to the result code. I have a page on my site that covers how to do this:

aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top