;24HourCapture.WAS v1.0
;*****************************************************************************
;* *
;* 24HourCapture.WAS *
;* Copyright (C) 1998 Quarterdeck *
;* All rights reserved. *
;* *
;* Written by: Quarterdeck ASPECT Assist *
;* 06/23/97 *
;* *
;* This script file will give the user the option of either capturing data *
;* in half hour increments, or in 24 hour increments. The Capture file will *
;* close after a predefined period of inactivity on the port. *
;* *
;* This ASPECT script is intended only as a sample of ASPECT programming. *
;* Quarterdeck makes no warranty of any kind, express or implied, including *
;* without limitation, any warranties of merchantability and/or fitness *
;* for a particular purpose. Use of this program is at your own risk. *
;* *
;* Technical Support is not provided on this script. * *
;*****************************************************************************
;*************************************************************************
;* MACRO *
;*************************************************************************
#define CapFormat 0 ; 0 for 1/2 hour capture file, 1 for 24 hour capture file.
#define FileName 1 ; 0 for fixed name capture file, 1 for time/date file name.
#define CapPath "C:\" ; Directory for capture files.
#define FixedName "CapFile.CAP" ;Default set Capture file name.
#define Increment 15 ; Increment in minutes, for specific min. capture file.
#define DialName "Company" ; The Name of entry to dial back if connection is lost.
;*************************************************************************
;* MAIN *
;*************************************************************************
proc main
when $carrier call DialBack
set capture path CapPath
StartProcess()
endproc
;*************************************************************************
;* StartProcess *
;*************************************************************************
proc StartProcess
string CapFileName
while 1
if FileName ;If FileName = 1 set capture to time/date.
DateName(&CapFileName)
else
CapFileName = FixedName ;Else use set capture name.
endif
set capture file CapFileName ;Set the capture filename for Procomm.
capture on ;Start the capture file.
if CapFormat ;If CapFormat = 1 start 24hr capture.
Cap24()
else
CapHalf() ;Else start half hour capture file.
endif
endwhile
endproc
;*************************************************************************
;* DateName *
;*************************************************************************
proc DateName
param string CapFileName
string CapTime, CapDate, TempVar1, TempVar2
TempVar1 = $time24 ;Get the current time.
strextract CapTime TempVar1 ":" 0 ;Get hours from time.
strextract TempVar2 TempVar1 ":" 1 ;Get min. from time.
strcat CapTime TempVar2 ;Add min. to hours.
TempVar1 = $date ;Get the current date.
strextract CapDate TempVar1 "/" 0 ;Get month from date.
strextract TempVar2 TempVar1 "/" 1 ;Get day from date.
strcat CapDate TempVar2 ;Add day to month.
CapFileName = CapTime ;Set filename to time.
strcat CapFileName CapDate ;Add date to filename.
strcat CapFileName ".CAP" ;Add '.cap' extension to filename.
endproc
;*************************************************************************
;* Cap24 *
;*************************************************************************
proc Cap24
string StopHour, StopMin, TempTime, TempVar, TempVar2
integer TempInt, IntHour, IntMin
TempTime = $time24 ;Get the current time.
strextract StopHour TempTime ":" 0 ;Get hours from time.
strextract StopMin TempTime ":" 1 ;Get min. from time.
atoi StopHour IntHour ;Convert ASCII hour to integer.
atoi StopMin IntMin ;Convert ASCII minute to integer.
if IntMin > 0
IntMin = IntMin - 1
else
If IntHour > 0
IntHour = IntHour - 1
else
IntHour = 23
endif
IntMin = 59
endif
itoa IntHour StopHour ;Convert integer hour to ASCII.
itoa IntMin StopMin ;Convert integer minute to ASCII.
strlen StopHour TempInt
if TempInt == 1 ;If 1 digit number.
TempVar = StopHour
StopHour = "0" ;Add 0 in front of digit to make it 2 digits.
strcat StopHour TempVar
endif
strlen StopMin TempInt
if TempInt == 1 ;If 1 digit number.
TempVar = StopMin
StopMin = "0" ;Add 0 in front of digit to make it 2 digits.
strcat StopMin TempVar
endif
strcat StopHour ":"
strcat StopHour StopMin ;Add minutes to hours.
while 1
TempTime = $time24 ;Get the current time.
strextract TempVar TempTime ":" 0 ;Get hours.
strextract TempVar2 TempTime ":" 1 ;Get min.
strcat TempVar ":"
strcat TempVar TempVar2 ;Add min. to hours.
statmsg "Capture file will stop at %s current time is %s" StopHour TempVar
if strcmp TempVar StopHour ;If StopTime = Current time.
waitquiet ;Wait for no terminal activity.
capture off ;Close the capture file.
exitwhile ;Exit the while loop.
else
yield ;Yield processing time.
endif
endwhile
endproc
;*************************************************************************
;* CapHalf *
;*************************************************************************
proc CapHalf
string StopHour, StopMin, TempTime, TempVar, TempVar2
integer TempInt, IntMin, IntHour
TempTime = $time24 ;Get the current time.
strextract StopHour TempTime ":" 0 ;Get hours from time.
strextract StopMin TempTime ":" 1 ;Get min. from time.
atoi StopHour IntHour ;Convert ASCII hour to integer.
atoi StopMin IntMin ;Convert ASCII minute to integer.
IntMin = IntMin + Increment
if IntMin > 59
IntMin = IntMin - 60
if IntHour == 23
IntHour = 00
else
IntHour = IntHour + 1
endif
endif
itoa IntHour StopHour ;Convert integer hour to ASCII.
itoa IntMin StopMin ;Convert integer minute to ASCII.
strlen StopHour TempInt
if TempInt == 1 ;If 1 digit number.
TempVar = StopHour
StopHour = "0" ;Add 0 in front of digit to make it 2 digits.
strcat StopHour TempVar
endif
strlen StopMin TempInt
if TempInt == 1 ;If 1 digit number.
TempVar = StopMin
StopMin = "0" ;Add 0 in front of digit to make it 2 digits.
strcat StopMin TempVar
endif
strcat StopHour ":"
strcat StopHour StopMin ;Add minutes to hours.
while 1
TempTime = $time24 ;Get the current time.
strextract TempVar TempTime ":" 0 ;Get hours.
strextract TempVar2 TempTime ":" 1 ;Get min.
strcat TempVar ":"
strcat TempVar TempVar2 ;Add min. to hours.
statmsg "Capture file will stop at %s current time is %s" StopHour TempVar
if strcmp TempVar StopHour ;If StopTime = Current time.
waitquiet ;Wait for no terminal activity.
capture off ;Close the capture file.
exitwhile ;Exit the while loop.
else
yield ;Yield processing time.
endif
endwhile
endproc
;*************************************************************************
;* DialBack *
;*************************************************************************
proc DialBack
if $carrier == 1
return
else
dial DATA DialName ; Dial DialName entry.
while $DIALING ; Loop while dialing.
endwhile
pause 1
if $CARRIER == 0 ; See if we're connected.
errormsg "Could not make a connection!"
else
endif
endif
return
endproc