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!

Set aspect rgetchar

Status
Not open for further replies.

iSDX

Technical User
Jul 24, 2002
64
AU
I am trying to use the set aspect rgetchar to terminate the rget command, I have set the rgetchar to 63 "?"
and have check this by using the fetch command. Unfortunately the script doesn't following this instruction.
I have checked the incoming string by using the command strchr to check if the remote system has sent a "?" and this proves true. The remote system is a PABX and the command prompt is "?" The script works fine with a time delay, but ever system has a different time delay before giving the command prompt, to enter the next command.
Unfortunately I am not a programmer and would appreciate any help on this issue.

here is the part of the script which is in question.

i=0

While not nullstr table_namearray ;Loop while array elements !=0

Transmit "xa "
Transmit Table_Namearray
Transmit " " ;Send command to the PABX
Transmit SPLEI
Transmit " 1 o 0"
Transmit "^M"

Rget iSDX_ECHO 80 5 ;ignore ECHO back from the PABX of ;the above command

fetch aspect rgetchar bla
;usermsg "%d" bla
set aspect rgetchar 63 ;terminating char for rget set to" ?" ;63 ascii
fetch aspect rgetchar bla
;usermsg "%d" bla

While 1
Rget VALUE 28 forever raw ;Get data,place in string value, ;timeout if ? is recieved
Substr Offset_Str VALUE 14 4 ;Strip value and place require string ;in Offset_str
atoi Offset_Str Offset_cnt ;Convert Offset_str to an integer, ;base 10.
DIVarray[offset_cnt] = 1 ;Place one in the array index define ; by Offset_cnt

If failure
Exitwhile
endif
Endwhile

i++ ;Bump up ;table_namearray index
Endwhile
 
It take it that the if failure command a few commands after the rget is failing? Have you tried using the usermsg command to print the current contents of VALUE to see if it is what you are expecting? I tried this on one of my machines and rget did exit (and return success) when it received a question mark.

If you are just waiting for the ? prompt, you could use either the waitfor or when target commands to key on that character as well.

 
Thanks for the advice Knob, I tried "When target" and this worked.
I also changed "while 1" to "while $Rxdata" and the Rget exits now on the receipt of a "?"

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top