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

Delay 2nd script from running until 1st is done 1

Status
Not open for further replies.

BStephens

MIS
Jun 20, 2005
35
US
I am running a batch file on an XP machine that will log into my phone switch with a procomm script that is contained in the "Basic Options" portion of the Connection Directory. This all works well and it logs into my switch. My problem lies with trying to get another script wait for the login script in the connections directory to finish before running a script containing the process that I need to run. I have sort of gotten around this by creating a connection for each script that I want to run. I would prefer to have one connection that will log in and then run what ever script that I instruct it to in the batch file. I hope this makes sense. I am just starting to branch out further then just recorded scripts.
 
Not sure I understand you correct, but you can have the first script start the next script right at the end of the script with the execute-command.

If that's not an option, maby you could have the first script create a "dummyfile" right before it terminates, and then in the second script test for the existens of this file. Then the script code starts when the file is found, and have the second script remove the file.

A third option could be to chain both scripts together in one script like this:
Code:
proc main

  ; Body of your first script goes here.

  call script2   ; calls your second script here
                 ; at the end of the first.
endproc

proc script2

  ; Body of your second script goes here.

endproc
Hope this helps
 
I will try to make more sense this time. I have a batch file (Start "" "C:\Progra~1\Symantec\PROCOM~1\PROGRAMS\PW5" connect Data Mail)with Mail being my connection in the Data Connection Directory. In Mail under Settings\Bassic Options I have a script called "Logi_R" that automatically logs into my phone switch. I would like to have "Mail" run, log into the switch, and then run a second script after the login script is done. Below are the login script and the second scritp that I want to run after login.

Logi_R:
proc main

if findfirst "logi.wax" ; Find a script file to run.
termreset ; Clear and reset terminal.
chain $FILENAME ; Run the script file found.
usermsg "This message doesn't get processed!"
else
errormsg "Login script not found!"
endif

endproc

Second script: To Get Previous History Record
proc main
integer iDay, iMonth, iYear, iMin, iHour, iSec
string fname

ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt fname "History_%02d_%02d_%d_%d_%d.txt" iMonth iDay iYear iHour iMin

set capture file fname

capture on
transmit "****^M"
waitfor ">"
transmit "LD 22^M"
waitfor "REQ"
transmit "TID^M" ;Get tape ID

waitfor "REQ "
transmit "PRT^M" ;Print
waitfor "TYPE "
transmit "PHST^M" ;All History File
waitquiet 3 FOREVER
transmit "*^M"
waitfor "REQ "
transmit "END^M"
waitfor ">"

capture off
set capture file none ;clears capture name
endproc
 
Bill,

I edited this do what I think your looking for. This is now written so it will run the main procedure that resets the screen and calls the log-in script. It will then return to the original script because I used the execute command instead of the chain command and run the second section. I added a LOGO at the end to log out. If your doing dial in you may want to add the "disconnect" command at the end too.

I tested this dialing into a switch it seemed to run OK.

Ron

Code:
proc main
   
   if findfirst "logi.wax" ; Find a script file to run.
      termreset    ; Clear and reset terminal.
      execute $FILENAME   ; Run the script file found.
     else
      errormsg "Login script not found!"
   endif
call Second_script  
endproc

;Second script: To Get Previous History Record
proc Second_script
integer iDay, iMonth, iYear, iMin, iHour, iSec
string fname

ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt fname "History_%02d_%02d_%d_%d_%d.txt" iMonth iDay iYear iHour iMin

set capture file fname
 
capture on
transmit "****^M"
   waitfor ">"
   transmit "LD 22^M"
   waitfor "REQ"
   transmit "TID^M"    ;Get tape ID
   
waitfor "REQ "
transmit "PRT^M"     ;Print
waitfor "TYPE "
transmit "PHST^M"    ;All History File
waitquiet 3 FOREVER
transmit "*^M"
waitfor "REQ "
transmit "END^M"
waitfor ">"
capture off
transmit "logo^M"
set capture file none  ;clears capture name
endproc
 

In reading your message again I saw your looking to call this from a bat file. Here is how I would call it in a bat file. First create a dial-in entry in your dialing directory and under "basic options" for this entry assign your script you have written.

The path may be different in your PC but the command line looks like this. The name of the dial-up entry goes in quotes at the end.

Code:
"C:\comm\Procomm Plus\PROGRAMS\PW5.EXE"  terminal connect "chicago PBX"

I think there is a way to call the script in the command line but this has always worked better for me because it sets up the terminal type dial in number and all that stuff and it works well!!

Hope this helps
Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top