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!

User with no Aspect skills needs capture file help 1

Status
Not open for further replies.

wolf2blue

IS-IT--Management
Oct 3, 2005
28
US
Hi All, forgive me but I'm very new at this.
Here is what I am trying to do.

settings
V-100
direct-connect to com1 9600 8N1 no flow control

Capture all incoming data to a capture file real time or as close to real time as is possible.
I would like the capture file to be named ACDMMDDYYYYHHMM (ie April 13 2006 05:00 would create a file named ACD041320060500). We need to create a new capture
file at 5am and close the capture file at 7pm each day. Should the system or Procomm Plus be restarted between 5am and 7pm a new file needs to be created with the naming convention from above.

Thank you for taking the time.
Kurt
 
I have a few examples of creating filenames based on the date and time on my site (check the samples page) that should get you started in that regards. You'll just need to use the set capture name command (and set capture file if not using the default capture directory) to set those value prior to opening the capture file in your script.

You can use the waituntil command to have the script pause until 5 AM and then again to turn off the capture file at 7 PM. One thing to be aware of is that the data is not actually saved to the capture file until the capture OFF command has been issued.

 
Thanks knob,
I will look over the samples on your site again. About the tip "the data is not actually saved to the capture file until the capture OFF command has been issued". Should the script turn capture ON at say xx:55 and then OFF at xx:05 to make sure that the hourly data is written into the capture file?
 
Actually you would want to do it the other way around (turn off the capture file first and then back on). I wouldn't have a time gap like that between closing and opening the capture file. One thing to be aware of is that any data on the screen is written to the capture file when it is turned on, so if you were to close and reopen the file, the last screen's worth of data would be in the capture file twice. You can issue a clear command so that the data does not appear a second time, but you would get a screen's worth of blank lines instead.

Actually, reading your message again, it looks like you are just needing data that is sent around the top of the hour, correct? If so, then you could get by with turning the capture file on a few minutes before the hour and then closing it a few minutes after the hour.

 
Hi wolf2blue

try this:

; set Capture file name plus date v01- by JMF 170406

string szTime,szDate,sl1_h,sl1_m,sl1_s,sl1_dia,sl1_mes,sl1_ano
string SFilename,stemp,stype ="0 - SCREEN" ;,SFileSpec = "c:\*.txt"
string Stimesp =":",Sdatesp="-",Sext = ".cap"
string Sstrt = "00:00:00",Sstp ="23:59:00",Spath = "c:\" ,Spref = "Log",Sindic = " OFF"
integer istrt,istp,Event,Iswttype = 41,itype = 0
integer loops,icomsw = 1
integer il1_h,il1_m,il1_s,il1_dia,il1_mes,il1_ano

proc main ;*****************************************************************

call janela

endproc ;*****************************************************************

proc capcontrol ;*****************************************************************

while 1

waituntil sstrt

alarm 3
Sindic = "ON"
dlgupdate 0 24
call filecaptureon

waituntil sstp

alarm 3
Sindic = " OFF"
dlgupdate 0 24
call filecaptureoff

endwhile

endproc ;*****************************************************************

proc datahora ;*****************************************************************

ltimestrs $LTIME szDate szTime
strextract sl1_dia szDate Sdatesp 0
strextract sl1_mes szDate Sdatesp 1
strextract sl1_ano szDate Sdatesp 2
strextract sl1_h sztime Stimesp 0
strextract sl1_m sztime Stimesp 1
strextract sl1_s sztime Stimesp 2
atoi sl1_dia il1_dia
atoi sl1_mes il1_mes
atoi sl1_ano il1_ano
atoi sl1_h il1_h
atoi sl1_m il1_m
atoi sl1_s il1_s
strfmt sl1_dia "%02d" il1_dia
strfmt sl1_mes "%02d" il1_mes
strfmt sl1_ano "%04d" il1_ano
strfmt sl1_h "%02d" il1_h
strfmt sl1_m "%02d" il1_m
strfmt sl1_s "%02d" il1_s
switch Iswttype

case 41

stemp = ""
strcat stemp spref
strcat stemp sl1_dia
strcat stemp sl1_mes
strcat stemp sl1_ano
strcat stemp sl1_h
strcat stemp sl1_m
strcat stemp sext

endcase
case Iswttype == 42

stemp = ""
strcat stemp spref
strcat stemp sl1_mes
strcat stemp sl1_dia
strcat stemp sl1_ano
strcat stemp sl1_h
strcat stemp sl1_m
strcat stemp sext

endcase
case 43

stemp = ""
strcat stemp spref
strcat stemp sl1_ano
strcat stemp sl1_mes
strcat stemp sl1_dia
strcat stemp sl1_h
strcat stemp sl1_m
strcat stemp sext

endcase
endswitch

sfilename = stemp
dlgupdate 0 11

return


endproc ;****************************************************************

proc Filecaptureon ;****************************************************************

string stemp0

set capture query 0
call datahora
set capture path spath
set capture file sfileName
strextract stype stemp0 " " 0
atoi stemp0 itype
set capture recordmode Itype
capture on

return

endproc ;******************************************************************
proc Filecaptureoff ;******************************************************************

capture off

return

endproc ;*********************************************************************
proc janela ;*********************************************************************

dialogbox 0 146 73 264 169 27 "Capture with filename plus date&time V1.0 JMF 14042006"
text 91 50 32 180 11 "Time To Start Capturing" left
editbox 2 10 30 34 11 Sstrt 8
text 93 50 47 180 11 "Time To Stop Capturing " left
editbox 4 10 45 34 11 Sstp 8
text 95 100 62 180 11 "Path For Saving Capture Files" left
editbox 6 10 60 80 11 Spath
text 97 100 77 180 11 "Prefix Name Of the File Ex: Log" left
editbox 8 10 75 80 11 Spref
text 99 50 92 180 11 "File extension example: *.cap, *.txt" left
editbox 10 10 90 34 11 Sext 8
text 92 10 8 240 8 "The resulting file will be : " left
groupbox 31 5 2 254 18 ""
text 11 100 8 240 8 sfilename left
combobox 13 10 150 64 46 DROPDOWNlist "0 - SCREEN,1 - FILTERED,2 - RAW" stype
text 94 80 152 100 12 "Record Mode Type" left
groupbox 33 5 104 252 28 ""
text 20 10 110 240 10 "* Time must be set to 24 hour format ex: 15:00:00 or 09:00:00" left
text 21 10 120 240 10 "** The directory defined in path must exist - Ex: C:\CAPTDIR\*.cap" left
groupbox 34 150 130 81 15 ""
groupbox 35 235 130 22 15 ""
text 23 151 135 78 8 " RUNNING - CAPTURE ->" left
text 24 238 135 16 8 Sindic center
checkbox 9 10 135 140 10 " Close this window when running " icomsw
groupbox 32 198 20 60 42 " Date Format "
radiogroup 40 Iswttype ; Define radio group.
radiobutton 41 200 30 56 10 "DDMMYYYY"
radiobutton 42 200 40 56 10 "MMDDYYYY"
radiobutton 43 200 50 56 10 "YYYYMMDD"
endgroup
groupbox 36 188 144 70 19 ""
pushbutton 29 235 150 20 11 "GO"
pushbutton 30 191 150 20 11 "Exit" cancel
enddialog
dlgupdate 0 1,42
disable DLGCTRL 0 23,24

while 1

dlgevent 0 Event ; Get dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
call datahora
dlgupdate 0 11
yield
endcase

case 29 ;GO Button was pressed.

atoi Sstrt istrt
atoi Sstp istp

if nullstr sstrt
loops = 0
while (Loops++) < 3
beep
mspause 500
disable DLGCTRL 0 2
beep
mspause 500
enable DLGCTRL 0 2
Sstrt = "Error"
dlgupdate 0 2
mspause 200
endwhile
Sstrt = ""
dlgupdate 0 2

else
if icomsw == 0
enable DLGCTRL 0 23,24
disable DLGCTRL 0 1,10
disable DLGCTRL 0 13
disable DLGCTRL 0 40
;disable DLGCTRL 0 25,40
else

exitwhile

endif

call capcontrol
endif
endcase
case 30
halt
endcase
endswitch
endwhile
dlgdestroy 0 OK ; Get rid of dialog box.

call capcontrol

endproc ;****************************************
 
Hi
sorry I will post it again, it seems it was a bug
It was a loop somewhere... let me have a look first ... sorry
I didn't tried yet after a day passed.
 
Just a short update form my no skills side.
First thanks knob and cmptsul01. I have the script (one from the sample site Created 06JUN05 by Bill Hillman) creating the file name I needed. Now for part two. How to have capture turn on 5 min. before the top of the hour and turn capture off 5 min. after the hour. Do I need a capture on and a waituntil for every hour I want to capture. Or is there a way to tell the script to turn capture on at every xx:55 and off at xx:05. Then there is part three. That is the part where something or someone closes ProComm or restarts the computer. I am sure the script will create the capture file but will it resume capture at the next xx:55.
 
I think I have it the long way around. Can someone tell me if there is a faster / cleaner way or if this script just will not work and why.
Thank you


;***********************************************************************
;* 17Apr06 By Kurt Started from a sample by Bill Hillman ;***********************************************************************

#define DEBUG 0
string fname ;first part of file name
string datefilename ;this is the date part of file name

proc main

dial data "ACD1_Com1"

while 1
clear ;clear screen
fname = "ACD_" ;put the first part of name here leave a space at the end
datefilename = "" ;to ensure string datefilename is empty
call file_date ;calls file_date proc
strcat fname datefilename ;this combines the two string (in this case M1_Log YYYYMMDD)
set capture path "C:\Program Files\Procomm Plus\Capture"
set capture file fname ;sets caputure file to the file named in file_date proc
waituntil "06:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "07:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "07:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "08:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "08:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "09:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "09:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "10:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "10:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "11:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "11:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "12:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "12:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "13:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "13:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "14:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "14:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "15:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "15:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "16:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "16:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "17:05:00" ;keeps capturing until this time
capture off ;turns capture off
waituntil "17:55:00" ;keeps capturing until this time
capture on ;turns on capture
waituntil "18:05:00" ;keeps capturing until this time
capture off ;turns capture off

waituntil "06:50:00" ;keeps capturing until this time

endwhile
endproc

proc file_date
integer iMonth, iDay, iYear, iHour, iMin, iSec
ltimeints $LTIME iMonth iDay iYear iHour iMin iSec
strfmt dateFileName "%02d%02d%d%02d%02d" iMonth iDay iYear iHour iMin
strcat dateFileName ".TXT"
endproc
 
There are a way or two to not hardcode the times to turn the capture file on and off (for example, you could have a for loop from 6 to 18, then use strfmt to create the full time with minutes), but I'd say your script is OK in that regards.

What kind of problems are you running into with the existing script? Everything looks OK at a first glance.

 
Thanks for your help. Should I put clear command before each capture ON? Trust me when I say you will be seeing more post from me.
 
Oh I have changed the comments to "Starts capturing at this time" and to "Stops capturing at this time". I did not update the post to save space on the site.
 
Oh yeah, how can I hard code VT-100 9600 8N1 no flow control and direct connect-com1 in the script.
 
Yes, I would put a clear before each capture on command so that you don't get the previously-saved data when the capture file is reopened.

Here are the commands to hard-code the connection parameters:

set port baudrate 9600
set port databits 8
set port parity NONE
set port stopbits 1
set port hardflow OFF
set port softflow OFF
set modem connection "direct connect-Com1"
set terminal type VT100

 
Ops. I put it into a loop by not waiting till 00:01. Here is the script I have in place now. I'll update in the morning if all is well.


#define DEBUG 0
string fname ;first part of file name
string datefilename ;this is the date part of file name

proc main

while 1
set port baudrate 9600
set port databits 8
set port parity NONE
set port stopbits 1
set port hardflow OFF
set port softflow OFF
set modem connection "direct connect-Com1"
set terminal type VT100
clear ;clear screen
fname = "ACD_" ;put the first part of name here leave a space at the end
datefilename = "" ;to ensure string datefilename is empty
call file_date ;calls file_date proc
strcat fname datefilename ;this combines the two string (in this case M1_Log YYYYMMDD)
set capture path "C:\Program Files\Procomm Plus\Capture"
set capture file fname ;sets caputure file to the file named in file_date proc
waituntil "06:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "07:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "07:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "08:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "08:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "09:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "09:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "10:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "10:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "11:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "11:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "12:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "12:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "13:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "13:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "14:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "14:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "15:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "15:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "16:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "16:55:00" ;Starts capturing at this time
clear
capture on ;turns on capture
waituntil "17:05:00" ;Stops capturing at this time
capture off ;turns capture off
waituntil "17:55:00" ;Starts capturing at this time
clear ;clear screen
capture on ;turns on capture
waituntil "18:05:00" ;Stops capturing at this time
capture off ;turns capture off
clear ;clear screen
waituntil "23:59:55" ;Starts capturing at this time
pause 20 ;Pause for midnight
waituntil "06:50:00" ;Starts back at while 1

endwhile
endproc

proc file_date
integer iMonth, iDay, iYear, iHour, iMin, iSec
ltimeints $LTIME iMonth iDay iYear iHour iMin iSec
strfmt dateFileName "%02d%02d%d%02d%02d" iMonth iDay iYear iHour iMin
strcat dateFileName ".TXT"
endproc
 
Update: Everything worked fine this morning and so far throughout the day. I do have another question though. Is there away to set the number of terminal lines to 1? This is only an issue if you have to restart Procomm, the script and or the system. It writes a screen full of blank lines for each capture On / Off.
Thanks
 
You can't do this through Procomm's Setup dialog, but it looks like you could use:

set terminal rows 1

to do this (I have not tested that yet) according to the ASPECT help file.

 
It will compile with 1 but it errors "Error 1: Value out of range". So I set it to 2, works just fine. 20 blank lines vs 258 blank line. You are the aspect master. Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top