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!

Variable Question

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
I have a script File Associated with a Entry in the Dialing Directory. This Script File (will call it Main), Opens a DialogBox with 7 Pushbuttons. Selecting A PushButton brings up (yes You guessed it) another DialogBox with Five options. Selecting A PushButton brings up (yes You guessed it) another DialogBox with Four options. These are the Commands you want to Run on you PBX.

My Question is After all these selections I want ProComm to Dial the Orginal Entry Selected. When I have just 1 script i can assign $DIALENTRY to the variable MyEntry, and then use dial DATA $DIALENTRY. However when I have Multiple DialogBoxes (Script Files), ProComm loses the Variable.

ANy Ideas??
 
Are these dialogboxes contained in other scripts that your main script is calling via the execute command? If so, then you'll need to assign the value to one of the global variables (s0-s9 for strings) and then reference that variable in the executed script. You cannot share variables that you define between scripts. I haven't had time to test this, but you may also need to add the SHARED keyword at the end of the execute command to be able to share the global variables among different scripts.
aspect@aspectscripting.com
 
2 Quick Questions.

1. How do I define a Global Variable??
Is the #DEFINE MyEntry = $DIALENTRY (before the Proc Main Command)?

2. How to I retrieve the Global Variable?? When i Called it MyEntry, it was not recognized in the Executed script. I even tried adding the Shared command.

Thanks
 
To define a global variable, declare a variable as usually would, but place the declaration (integer iTest, etc.) before the proc main statement. However, for the case where you want to share variables between scripts, you will need to use the predefined global variables. The predefined globals are:

s0 through s9 - string
f0 through f9 - float
i0 through i9 - integer
l0 through l9 - long

What you will want to do is assign the value of $DIALENTRY to a global string variable in your main script as such:

s0 = $DIALENTRY

When the child script executed by your main script runs, the value of s0 (containing the value of $DIALENTRY) will then be available in your child script.
aspect@aspectscripting.com
 
Well,
I tried to get this to work, but apparently I am doing something wrong. I have a dialing directory setup and have added the "9005 Report Selection.wax" script to execute BEFORE Dialing. I set the Global Variable s0 to $DIALENTRY. when you select "Analog 9005.wax", it should run, but doesn't.

Here are my 2 Script files.

Code:
#DEFINE s0 = $DIALENTRY
proc main
integer Event


dialogbox 0 187 54 274 278 2 "                                 Switch Report Selection Screen" 
   pushbutton 141 82 2 100 24 "Analog Line Report" 
   pushbutton 142 82 34 100 24 "Capacity Study Report" 
   pushbutton 143 82 67 100 24 "Digital Line Report" 
   pushbutton 144 82 101 100 24 "Extension Line Report" 
   pushbutton 145 82 134 100 24 "Hardware Report" 
   pushbutton 146 82 167 100 24 "Hunt Group Report" 
   pushbutton 147 82 200 100 24 "Trunk Line Report" 
   pushbutton 148 108 238 50 28 "Exit" CANCEL 
enddialog 
   while 1
      dlgevent 0 Event
      switch Event
         case 0                   
         endcase
      case 141                   
	 execute "Analog9005.wax" SHARED
         disable DLGCTRL 0 141
      endcase
      case 142
	 execute "Capacity9005.wax" SHARED
         disable DLGCTRL 0 142
      endcase
      case 143
	 execute "Digital9005.wax" SHARED
         disable DLGCTRL 0 143
      endcase
      case 144
	 execute "Extension9005.wax" SHARED
         disable DLGCTRL 0 144
      endcase
      case 145
	 execute "Hardware9005.wax" SHARED
         disable DLGCTRL 0 145
      endcase
      case 146
	 execute "HuntGroup9005.wax" SHARED
	 disable DLGCTRL 0 146
      endcase
      case 147
	 execute "Trunk9005.wax" SHARED
	 disable DLGCTRL 0 146
      endcase
         default                  
            exitwhile             
         endcase
      endswitch
   endwhile
   dlgdestroy 0 CANCEL
endproc


Code:
proc main

   dial DATA S0            ;Dial the DIALENTRY set in Global Variable
   while $DIALING          ; Loop while dialing.
   endwhile
   if $CARRIER             ; See if we're connected.
      execute "Log 9751.wax"
   else
      errormsg "Sorry, not connected."
   endif

   if $CONNECTOPEN                      ; check for connection...
   call WriteFile
   waitquiet 2
      execute "9005 HELPDESK LOGIN.WAX" SHARED
      waitfor "COMMAND: ^]" FOREVER
      transmit "li sli all ^M"
      waitfor "COMMAND: ^]" FOREVER
      transmit "bye ^M"
      waitfor "% ^]"
      transmit "bye^M"
   else
      errormsg " The modem has lost the connection.. Please Reconnect."
      Capture OFF
      halt
   endif   
Capture OFF
HANGUP
HALT
endproc
proc WriteFile
   string CapPath ="C:\Temp Data Files\Raw Data\"
   string CapName ="Analog9005.txt"
   capture OFF
   waitquiet 1 
   set capture path CapPath                 
   set capture file CapName               
   set capture overwrite ON                
   set capture query OFF                      
   capture ON
   mspause 250
endproc

Any HELP will be appreciated.
 
You do not need the #define statement, you can just use s0 = $DIALENTRY at the appropriate part of your first script. However, $DIALENTRY only contains a value if the current script was launched from a Connection Directory entry. I'm not certain if your script is being launched by a Connection Directory entry, but wanted to point that out just in case.
aspect@aspectscripting.com
 
Almost forgot to mention that you shouldn't need the SHARED flag with your execute commands. I wrote one script that set s0 to a specified value, executed a second script without the SHARED flag, and the value was successfully accessed by that second script.
aspect@aspectscripting.com
 
Well,

The 9005 Report Selection.wax script is called for when the Entry (My House...ok not really but for arguments sake) in the Connection Directory is Dialed. The script is set to Run BEFORE the Connection is Dialed.

I Removed the "SHARED" component, per your advise. But it still doesn't work. See Below (9005 Report Selection.wax) is called by Clicking on the Dial Entry in the Connection Directory. In this instance if you Select the Button labled ANALOG REPORT, the sencond script runs (well it's supposed to).

What happens is all components of the script file run, EXCEPT it Never dials. However it does provide the correct Error message "Sorry Not Connected", Followed by: "The Modem has Lost Connection...please Reconnect"

I tried adding the Following line:

usermsg "The Following Entry will be dialed" s0

All I got was "The Following Entry Will be Dialed".

Code:
proc main
integer Event
s0 = $DIALENTRY

dialogbox 0 187 54 274 278 2 "                                 Switch Report Selection Screen" 
   pushbutton 141 82 2 100 24 "Analog Line Report" 
   pushbutton 142 82 34 100 24 "Capacity Study Report" 
   pushbutton 143 82 67 100 24 "Digital Line Report" 
   pushbutton 144 82 101 100 24 "Extension Line Report" 
   pushbutton 145 82 134 100 24 "Hardware Report" 
   pushbutton 146 82 167 100 24 "Hunt Group Report" 
   pushbutton 147 82 200 100 24 "Trunk Line Report" 
   pushbutton 148 108 238 50 28 "Exit" CANCEL 
enddialog 
   while 1
      dlgevent 0 Event
      switch Event
         case 0                   
         endcase
      case 141                   
	 usermsg "Entry" s0
	 execute "Analog9005.wax"
         disable DLGCTRL 0 141
      endcase
      case 142
	 execute "Capacity9005.wax"
         disable DLGCTRL 0 142
      endcase
      case 143
	 execute "Digital9005.wax"
         disable DLGCTRL 0 143
      endcase
      case 144
	 execute "Extension9005.wax"
         disable DLGCTRL 0 144
      endcase
      case 145
	 execute "Hardware9005.wax"
         disable DLGCTRL 0 145
      endcase
      case 146
	 execute "HuntGroup9005.wax"
	 disable DLGCTRL 0 146
      endcase
      case 147
	 execute "Trunk9005.wax"
	 disable DLGCTRL 0 146
      endcase
         default                  
            exitwhile             
         endcase
      endswitch
   endwhile
   dlgdestroy 0 CANCEL
endproc


SCRIPT 2

Code:
proc main

   dial DATA $DIALENTRY                         ;Dial the DIALENTRY set in Global Variable
   pause 3
   while $DIALING          ; Loop while dialing.
   endwhile
   if $CARRIER             ; See if we're connected.
      execute "Log 9751.wax"
   else
      errormsg "Sorry, not connected."
   endif

   if $CONNECTOPEN                      ; check for connection...
   call WriteFile
   waitquiet 2
      execute "9005 HELPDESK LOGIN.WAX" SHARED
      waitfor "COMMAND: ^]" FOREVER
      transmit "li sli all ^M"
      waitfor "COMMAND: ^]" FOREVER
      transmit "bye ^M"
      waitfor "% ^]"
      transmit "bye^M"
   else
      errormsg " The modem has lost the connection.. Please Reconnect."
      Capture OFF
      halt
   endif   
Capture OFF
HANGUP
HALT
endproc
proc WriteFile
   string CapPath ="C:\Temp Data Files\Raw Data\"
   string CapName ="Analog9005.txt"
   capture OFF
   waitquiet 1 
   set capture path CapPath                 
   set capture file CapName               
   set capture overwrite ON                
   set capture query OFF                      
   capture ON
   mspause 250
endproc

Any IDEAS???


 
I bet what's happening (since you are running the script before dialing) is that $DIALENTRY is not being set because no dialing opeartion has yet taken place. I'll look at this a little more tonight. Also, you'll need to change the line "dial DATA $DIALENTRY" to "dial DATA s0" instead.
aspect@aspectscripting.com
 
Sorry,

I had changed that line when I was testing to Make sure the $DIALENTRY command was working.
 
It looks to me like the value of $DIALENTRY is being set correctly the first time your script runs, but it is not on subsequent dial attempts (unless you restart Procomm or switch to another mode and back to data mode). Is there a reason that you can't run your script after connection instead (this worked twice in a row for me)?
aspect@aspectscripting.com
 
Knob,

I was trying to see if I could get it to work prior to dialing because there are occasions when I may need to perform some steps prior to connection. However, I have changed my script to run after the connection is made.

Thanks for all the assistance, I really appreciate all the time you have put into this for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top