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 ;****************************************