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

Pausing a script

Status
Not open for further replies.

brewerdude

IS-IT--Management
Sep 8, 2003
472
US
I'm trying to write a script that interacts with our phone system to build phones. Before building the phone I delete the port I want to build it on, however, if the phone is "acquired" to our call center, it cannot be deleted. So, in this case I want to give the user the ability to "deaquire" the phone from the call center application, then have the script continue on where it left off. I am under the impression that opening a message box pauses the script until the users clicks 'OK', but I could be wrong. The following is the snippet of code that performs what I want it to do, but it never works. The variable never seems to get assigned properly in the sub-proc. I'm not sure if the script is going too fast, but I've added some pause statements, and they don't help either. All of the variables you see here have been declared as global variables.

;*******************************
;** OUT ANY EXISTING PHONE **
;*******************************
outphone:

transmit "******^M"
transmit "LD 20^M"
waitfor "REQ:"
transmit "DISU "
transmit New_TN
waitfor "REQ:"
transmit "out^M"
waitfor "TYPE: "
transmit Phone_Type
waitfor "TN "
transmit New_TN
when TARGET 0 "SCH0128" call enter_stars ;This is the code returned by the PBX if there is no phone

when TARGET 1 "SCH1509" call acquired ;This is the code returned by the PBX if the phone is acquired

if deacquire == 1
usermsg "Phone is acquired. Please deaquire %s." deacquire New_Tn ;script pauses while user deacquires phone from call center
deacquire = 0
goto outphone
endif

[there's bunch of code here for other stuff]



proc acquired
deacquire = 1

endproc





 
The problem likely is that the acquired procedure may not have been called until after the when target has fired. I would try moving the two when target commands a couple lines higher.

Does the usermsg pop up as expected?

 
After transmitting New_TN, if it's acquired then the PBX will immediately spit that out. If I put a user msg in the subproc, I will get that. Which is weird, b/c I get the message, but the variable doesn't seem to get assigned.

I think I tried that before and it didn't happen. I put them where they are b/c I thought the script returns to the main proc just after the when statement. I've used this for other error messages, and they work fine.

I'll try that though.


 
a line that helps me is set txpace 30, not with the original problem but that let me remove a ton of pauses. i use call for simular problems, seems to work as long as my procedure doesn't attempt to open the same wud..

john poole
bellsouth business
columbia,sc
 
Actually, I got it to work by doing this:


;*******************************
;** OUT ANY EXISTING PHONE **
;*******************************
outphone:
;breakpoint
when TARGET 0 "SCH0128" call enter_stars ;This is the code returned by the PBX if there is no phone
when TARGET 1 "SCH1509" call acquired ;This is the code returned by the PBX if the phone is acquired

transmit "******^M"
transmit "LD 20^M"
waitfor "REQ:"
transmit "DISU "
transmit New_TN
pause 1
transmit "^M"
waitfor "REQ:"
transmit "out^M"
waitfor "TYPE: "
transmit Phone_Type
waitfor "TN "
transmit New_TN






;*******************************
;** BUILD THE PHONE **
;*******************************

waitfor "REQ:"

if deacquire == 1
deacquire = 0
goto outphone
endif




By moving the if statement down a few lines allowed it to "catch" it since it was blowing by it.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top