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!

waitfor command

Status
Not open for further replies.

yesilkalem

IS-IT--Management
Aug 4, 2001
26
0
0
TR
hello
I have a terminal screen te3270 and I have to capture some screens which contains a word .
I wrote a script but it didnt work .. how can I do ? the part is below.. thanks .

bir:
waitfor "Enter-PF1"

if SUCCESS
goto devam
else
transmit "^M"
goto bir
endif

devam:


endwhile

endproc

#include "PW5MENU.INC"
proc screentofile
capture on ; Open up the capture file.
menuselect PWMENU _5SCREEN_TO_CAP ; Menu item to send screen to capture file
capture off ; Close the capture file.
endproc
 
Does the waitfor never fire (you can check for this by placing something like usermsg "success" just before the goto devam call), or is screentofile never being called?

My hunch (just that since you didn't post the whole script), is that when you goto devam you are hitting the end of the while loop instead of breaking out of it like you intended. Right after the devam label, you might want to try an exitwhile command, which will force control out of the while loop and on to the next statement in your script (presumably the screentofile procedure).
 
hello again this is my whole script. the problem is my script does no find "TOPLAM:" . my terminal is strange I think. when I record script it perceives page not as normal characters.

for examle i recorded a script only I sent a enter it is below:

it sends enter end waits a few words but the words are not below...

THANKS.

transmit "^M"
waitfor "^[[23B^[[7C^[[0;7m^O ^[[68C^[[H"


proc main
string Fname = "c:\friends.txt"
string authcode[250]
string Line

integer Counter=0
fopen 0 Fname READ TEXT
while not feof 0
fgets 0 Line
Authcode[Counter]=Line

Counter++
devam:

transmit "1^M"
pause 1
transmit Line RAW
pause 3
call screentofile
transmit "^M"

bir:
waitfor "TOPLAM:"

if SUCCESS
goto devam
else
transmit "^M"
goto bir
endif

endwhile

endproc

#include "PW5MENU.INC"
proc screentofile
capture on ; Open up the capture file.
menuselect PWMENU _5SCREEN_TO_CAP ; Menu item to send screen to capture file
capture off ; Close the capture file.
endproc
 
The characters you receive after sending a carriage return are escape sequences sent by the remote machine, usually to format data in a specific way. Instead of having Procomm wait for those specific characters, you can modify the waitfor string to look for just the minimum amount of text that your script is expecting.

As for your script, I would try inserting some usermsg commands throughout the script just so you can get an idea of where your script is, and maybe tell if your script is doing something differently than you are. I would especially do this just before the waitfor command, as well as after the if statement and after the else statement.

I'm also a little concerned about this part of your script:

transmit "1^M"
pause 1
transmit Line RAW

You might want to consider putting a waitfor statement after the first transmit line in case the second transmit statement is being executed before the remote system is ready for the input.

One final thing I noticed is that the way the script is structured right now, I believe only the first line read from friends.txt will be transmitted. This is becuase you never get back to the beginning of the while loop to read another line of data from the file. I believe this could be resolved by removing the goto devam call from after the if statement. This would cause the if statement to do nothing at all if the waitfor command was successful, causing the script execution to return to the beginning of the while loop.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top