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

Child Script does not respond & runs CPU @ 100% 1

Status
Not open for further replies.

BourbonGuzzler

Programmer
Sep 18, 2002
7
AU
Hi All

I had these scripts working and then went and changed something now the child script will not respond to any button selection & runs the CPU @ 100%. Can anyone help?

Thanks
Kevin


;Fujistu 9600L Modify access level script written by Kevin Wilmink 22/8/2005
;Script to Ask user for type of phone (Analog or Digital) &
;then spawn RSMlevel.wax to Ask the user for the new access level (IDD, AUS, GNSW, NSW, GSYD, L&M, LOC & INT)
;returning I0 (predefined integer) based on user input

#define TRUE 1
integer WhichButton

proc main

integer Event

MakeDialog() ; Show the dialog box.
while TRUE ; Sit and wait for an event.
dlgevent 0 Event ; Get any event for our dialog box.
switch Event ; Evaluate the dialog event.
case 0 ; 0 indicates no dialog event.

endcase
case 2 ; These case statements indicate
case 3 ; that one the radio buttons was
endcase ; selected
default
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; destroy the dialogbox

ShowIt_Type()
endproc


;*************************************

proc MakeDialog ; User Dialog to input type of Handset

WhichButton = 0
dialogbox 0 3 14 150 97 11 "Select Phone Type"
radiogroup 1 WhichButton
radiobutton 2 25 18 55 12 "&Digital"
radiobutton 3 25 35 55 13 "&Analog"
endgroup
groupbox 5 9 2 117 54 "Button Choices"
pushbutton 6 65 77 40 14 "&Cancel" CANCEL DEFAULT
pushbutton 7 15 77 40 14 "&OK" OK
enddialog

endproc

;***********************************************

proc ShowIt_Type ;

switch WhichButton ; Evaluate the WhichButton variable

case 2
Digital() ; Call digital type modification procedure
endcase
case 3
Analog() ; Call analog type modification procedure
endcase
endswitch

endproc

;**************************************************
proc Digital ; Modify access level of digital extension based on button selection

string Extension ;local variable of Equipment Number to modify
string RSM ;local variable of RSM to change to

ERROR: ;obtain user input of Extension
if sdlginput "Enter Directory Number" "Enter DN:" Extension ;
if nullstr Extension ; check if null
errormsg "Please Enter a Valid Selection" ; ask user to enter an extension
alarm 1
mspause 500
goto ERROR ; loop if null
endif
else
goto END ; exit script if user selects CANCEL
endif

;I0 = 11
execute "RSMlevel.wax" ; calls RSMlevel.wax (child) for user input of RSM - returning I0 with appropriate code

transmit "\"
pause 1
transmit "cha mldt,," ;transmits the command with the variables extension & RSM
transmit Extension ;
transmit ",,"
itoa I0 RSM ;converts I0 (integer) to RSM (string)
transmit RSM ;
transmit "^M" ;

;usermsg "Extension = %s" Extension

END:
endproc

;*********************************************
proc Analog ; Modify access level of analog extension based on button selection

string Extension ;local variable of Extension to trace
string RSM

ERROR:
if sdlginput "Enter Directory Number" "Enter DN:" Extension
if nullstr Extension ; check if null
errormsg "Please Enter a Valid Selection"
alarm 1
mspause 500
goto ERROR ; loop if null
endif
else
goto END
endif

I0 = 11
execute "RSMlevel.wax" ;calls RSMlevel.wax for user input of RSM - returning I0 with appropriate code

transmit "\"
pause 1
transmit "cha slt,," ;transmits the command with the variables extension & RSM
transmit Extension ;
transmit ",,," ;
itoa I0 RSM ;converts I0 (integer) to RSM (string)
transmit RSM ;
transmit "^M" ;

END:
endproc


RSMLevel.wax

#define TRUE 1
integer RSM ; Global variable used for radiobuttons.


;**************************************************************
; MAIN
; The Main procedure calls MakeDialogRSM to construct and display
; a dialog. It waits in an endless loop for a dialog event.
; When a dialog event occurs (i.e., when the user chooses a
; radio button or presses the pushbutton) ShowRSM is called.
; Calls: MakeDialog_RSM, ShowRSM
; Modifies global variables: None
;**************************************************************

proc Main ; Start of Main procedure.

integer Event ; Variable used for dialog events.

MakeDialog_RSM() ; Show the dialog box.
while TRUE ; Loop and wait for an event.
dlgevent 0 Event ; Get any event for our dialog box.
switch Event ; Evaluate the dialog event.
case 7 ; Corresponds to the Exit button.
exitwhile ; exit case or the OK pushbutton.
endcase
endswitch
endwhile
ShowRSM() ; Call routine to display selection.

endproc ; End of Main procedure.


;**************************************************************
; MAKEDIALOG_RSM
; MakeDialog_RSM constructs and displays the dialog box. It then
; returns to Main.
; Calls:
; Called by: Main
; Modifies global variables: RSM (initializes it to 0)
;**************************************************************
proc MakeDialog_RSM

RSM = 0 ; Initialize RSM variable.

dialogbox 9 13 24 98 125 11 "Access Level"
radiogroup 1 RSM
radiobutton 17 25 20 42 9 "&IDD"
radiobutton 16 25 30 42 9 "&AUS"
radiobutton 15 25 40 42 9 "&GNSW"
radiobutton 14 25 50 42 9 "&NSW"
radiobutton 13 25 60 42 9 "&GSYD"
radiobutton 12 25 70 42 9 "&L&&M"
radiobutton 10 25 80 42 9 "&LOC"
radiobutton 11 25 90 42 9 "&INT"
endgroup
groupbox 8 21 4 50 100 "Button Choices"
pushbutton 7 27 110 40 14 "&OK" DEFAULT
enddialog

endproc ; Return to proc Main.


;**************************************************************
; SHOWRSM
; ShowIt checks the value of the global variable RSM
; after the pushbutton is pushed.
; Calls:
; Called by: Main
; Modifies global variables:
;**************************************************************
proc ShowRSM

switch RSM ; Evaluate the WhichButton variable.
case 17
I0 = 17
endcase
case 16
I0 = 16
endcase
case 15
I0 = 15
endcase
case 14
I0 = 14
endcase
case 13
I0 = 13
endcase
case 12
I0 = 12
endcase
case 10
I0 = 10
endcase
case 11
I0 = 11
endcase

endswitch

endproc
 
I think what you need to do is change this line in the child script:

dlgevent 0 Event ; Get any event for our dialog box.

to read:

dlgevent 9 Event ; Get any event for our dialog box.

since the dialog defined there has an ID of 9 instead of 0 (the main script's dialog ID is 0).



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top