Procomm Plus Script

script

 #comment

~~~ Automation Script for Meridian Procomm Plus Capture Files V2.2 ~~~

 

Purpose: To replace okidata printers with a PC connected to a TTY

Port to capture ACD or Traffic reports.

 

This aspect script will open the first Data Connection Directory in

Procomm Plus and assign the MMDDYYYY value to captured files. It

automatically checks to see if a file exist for the date value - if so,

it adds 1 to the file extension.

 

Thus, if the Procomm Plus program captures 24 files on the same day, the

capture directory will have; example: 01012003.cap and 01012003.001 through

01012003.023

 

Author: Chas

Date Updated: 6-25-2003

Tested: Win 98, Win NT 4.0 with Service Pack 5

 

Quick Install Instructions ------------------------------

1. Navigate to Procomm Plus and rename current startup.was to

oldstartup.was

2. Paste this startup.was script into the same directory.

 

Disclamer: Nortel and Meridian are Trademarks of Nortel Networks. There are no

waranties implied - use this program at your own risk. The program has been tested by Charles XXXXX and has not in any way interferred with other PC operations..

All intellectual rights are reserved.

#endcomment

 

 

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

;* Defines the Macro *

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

 

#DEFINE CaptureMode 0 ;sets the mode of the Capture file to Screen

 

 

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

;* Sets Global Variables *

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

string FileName = $NULLSTR ;holds the filename to name capture file

 

 

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

;* *

;* -------------------1st Procedure or MAIN------------------------------*

;* This procedure calls GetFileNam to generate the Date. *

;* Then calls CheckForFile to see Filenam already exist. *

;* StartCapture starts the Capture file. *

;* *

;* Globals: NONE *

;* Calls: GETFILENAM, CHECKFORFILE, STARTCAPTURE, *

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

 

proc Main

 

GetFileNam() ;calls the GetFileName proc

CheckForFile() ;calls the CheckForFile proc

StartCapture()

 

 

Endproc

 

 

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

;* *

;* GETFILENAM() *

;* The procedure GetFileName gets the system date and removes any illegal*

;* characters from the FileName *

;* *

;* Globals: FILENAME *

;* Calls: NONE *

;* Called by: Main *

;* *

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

proc GetFileNam

 

integer Position = 1

 

FileName = $DATE ;sets the name from Control Panel

while (Position != 0)

strfind FileName "/" Position ;searches for / (illegal character)

if failure ;tests for a failure

Position = 0 ;sets condition to False

else ;successful search

strdelete FileName Position 1 ;removes illegal character

endif

endwhile

while (Position != 0)

strfind FileName "-" Position ;searches for -(illegal character)

if failure ;tests for a failure

Position = 0 ;sets condition to False

else

strdelete FileName Position 1 ;removes illegal character

endif

endwhile

strcat FileName ".CAP"

endproc

 

 

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

;* *

;* CHECKFORFILE() *

;* The procedure CheckForFile looks for conflicts in filename structure. *

;* If a conflict exist it moves to Autoname procedure. *

;* If the Filename does not exist it moves back to MAIN. *

;* *

;* Globals: FILENAME *

;* Calls: FILEEXISTS *

;* Called by: Main *

;* *

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

proc CheckForFile

 

string CapturePath

 

fetch capture path CapturePath ;gets the current capture path

strcat CapturePath "" ;put a on the end of path

strcat CapturePath Filename ;put filename on the path

if isfile CapturePath ;check to see if file is in DIR

AutoName()

else

set capture overwrite OFF ;sets the capture to append

set capture file FileName ;sets the capture filename

set capture recordmode CaptureMode ;sets the mode

endif

endproc

 

 

 

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

;* *

;* AUTONAME() *

;* The procedure AutoName names a file for you with a numbered extension *

;* this will be used if the date of the file is duplicated. *

;* *

;* Globals: FILENAME *

;* Calls: NONE *

;* Called by: CheckForFile *

;* *

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

proc AutoName

 

string TargetStr = ".CAP"

string ReplaceStr = ".001"

string CapPath

float ReplaceFloat

 

while 1 ;loop until find a name

strreplace FileName TargetStr ReplaceStr

fetch capture path CapPath ;gets the current capture path

strcat CapPath "" ;put a on the end of path

strcat CapPath FileName ;put filename on the path

isfile CapPath ;is file in capture path

if failure ;no

fetch capture path CapPath ;gets the current cap path

set capture file FileName ;sets the capture filename

set capture recordmode CaptureMode ;sets the mode

exitwhile ;exits the loop

else ;yes

TargetStr = ReplaceStr ;sets new target string

atof ReplaceStr ReplaceFloat ;change to an integer

;usermsg "float value after atof %0.3f" ReplaceFloat

ReplaceFloat = ReplaceFloat + .001 ;increases integer by .001

strfmt ReplaceStr "%0.3f" ReplaceFloat ;formats string

strdelete ReplaceStr 0 1 ;deletes begining zero

endif

endwhile

endproc

 

 

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

;* *

;* STARTCAPTURE() *

;* The procedure StartCapture starts the Capture file and waits for the *

;* when command to fire in the Main procedure. *

;* *

;* Globals: NONE *

;* Calls: NONE *

;* Called by: Main *

;* *

;* NOTE: Pause 20 will keep the Procomm Plus program open for 410 *

;* seconds (Approx 7 Minutes). You may have to change this timer *

;* to suit your particulare needs *

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

proc StartCapture

 

 

winactivate $PWMAINWIN ; Make sure Procomm Plus has focus.

mspause 750

sendkey ALT 'D' ; Send ALT-D to open Connection Directory.

mspause 500 ; Pause to wait for menu.

Sendkey ALT 'C' ; Send ALT-C to open Connection.

mspause 500 ; Pause to show of playback selection.

sendkey 'C' ; Send C .

mspause 750

 

capture on ; Open up the capture file.

 

 

pause 20 ; Pause for 410 seconds.

 

capture off ; Close the capture file.

 

mspause 500 ; Pause to wait for closure

 

pwexit ; Close Procomm Plus

 

endproc