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!

Help with waitfor command

Status
Not open for further replies.

Pandab2002

IS-IT--Management
Apr 16, 2003
47
US
I am trying to write a script that captures a tnb dump from a nortel pbx. Here it is...simple right?

proc main
caprure on
transmit "ld 20^M"
waitfor "REQ: "
transmit "prt^M"
waitfor "TYPE: "
transmit "500^M"
waitfor "TN "
transmit "^M"
waitfor "CDEN "
transmit "^M"
waitfor "CUST "
transmit "^M"
waitfor "TEN "
transmit "^M"
waitfor "DATE "
transmit "^M"
waitfor "PAGE "
transmit "^M"
waitfor "DES "
transmit "^M"
waitfor "NACT "
transmit "end^M"
capture off
endproc

Well, the problem is the "waitfor "TEN " line. Only about half of my PBX's have that prompt. If I run the script below it hangs at that point in a PBX without that prompt. What I'd like to do is, after the transmit "500^M" prompt, I would like to put something in there that tells the script to just keep sending "^M" until waitfor "DES ", and then send one more "^M". I tried using if not waitfor "DES " and a few other things, but I haven't had any success. Any assistance would be greatly appreciated.

Paul...
 
One possible solution is to use when target. You could use this to call a common function that transmits "^M".

On the prompts, is there any other delimiting character after the "TEN " or similar prompts?

Something like "TEN >"?
 
No, there is nothing after "TEN ". I'll goof around with when target. Thanks.
 
You could try this:
Code:
proc main
capture on
   transmit "ld 20^M"
   waitfor "REQ: "
   transmit "prt^M"
   waitfor "TYPE: "
   transmit "500^M"
   
 when target 0 "TN" call sendreturn
 when target 1 "CDEN" call sendreturn
 when target 2 "CUST" call sendreturn
 when target 3 "TEN" call sendreturn
 when target 4 "DATE" call sendreturn
 when target 5 "PAGE" call sendreturn
 when target 6 "DES" call sendreturn

   waitfor "NACT " forever
   transmit "end^M"
capture off
endproc

proc sendreturn
   transmit "^M"
endproc
Tested on an Opt11c.
It will send an <RETURN> after each "target" is received,
regardless if they are in order or not.
If one target is not received, nothing is sent for that target.
You can of cource add more "targets"...
;-)
 
geirendre,

Thank you very much for that script. I tried that, it does work within reason, however, within the results of the prt command, some of those prompts occur. The CUST prompt, for example, occurs in every TN that is printed out. It looks like each time that one of those prompts are displayed, the script sends another "^M". Is there a way to tell the script to stop looking for them after the First occurrance? I added a when clear line after the

when target 6 "DES" call sendreturn

...but it just stopped the whole thing from working. Any suggestions?

Thanks,
Paul...
 
The command when suspend at the end of the when lines seems to have done the trick. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top