brewerdude
IS-IT--Management
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
;*******************************
;** 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