Hi,
I have the following script:
I'm trying to zip up the file wildcards that are created on the same day as the script is run. The script works fine except it zips up the filnames even if they have not been created that day, can anybody advise?.
Thx,
John
Dialog>MyDialog
Caption=GL Packaging
Left=300
Top=300
Width=305
Height=120
Label=Type Month / Week and Year:,5,5
Edit=MyEdit,5,22,230,For Example - 'Week 1 08' or 'Sept 08'
Button=Enter,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
//Use Memos for multiline edits
//Memo=MyEdit2,80,80,200,200,dd
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
If>result=2,end
If>result=3,Main
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>Main
ReadIniFile>c:\wg09.ini,mapping,sourcefiles,source
ReadIniFile>c:\wg09.ini,mapping,pcompleted,complete
Let>n=1
Label>business
ReadIniFile>c:\wg09.ini,archives,parm%n%,archive
If>archive=STOP,end
ReadIniFile>c:\wg09.ini,zipnames,parm%n%,zipname
If>zipname=STOP,end
Let>z=1
Label>files
ReadIniFile>c:\wg09.ini,%archive%,parm%z%,filename
If>filenamefiles
Day>the_day
Month>the_month
Year>the_year
Let>thisday=%the_year%%the_month%%the_day%
FileDate>%source%%filename%,fdate
if>fdate=thisday,zipfile,zipcounter
Label>zipfile
LibLoad>%SCRIPT_DIR%\Ziplib.dll,hZL
LibFunc>hZL,AddFiles,r,%complete%%zipname%,%source%%filename%,9,0
ZIP_Add>%complete%%zipname%,%source%%filename%,9,0,r
LibFree>hZL
Label>zipcounter
let>z=z+1
End>zipcounter
goto>files
End>zipfile
Label>counter
Let>n=n+1
End>counter
GoTo>business
Label>end
File Dates
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Use IfFileExists before doing ZIP_Add?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 50
- Joined: Fri Mar 23, 2007 10:14 am
marcus, I put:mtettmar wrote:Use IfFileExists before doing ZIP_Add?
IfFileExists>%source%%filename%,,files
before the ZIP_Add but it is still adding old files to the zip.
I thought this would have been enough:
Day>the_day
Month>the_month
Year>the_year
Let>thisday=%the_year%%the_month%%the_day%
FileDate>%source%%filename%,fdate
if>fdate=thisday,zipfile,zipcounter
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Code: Select all
I'm not sure if this works:
If>filename<STOP>files
If>filename<>STOP,files
may be better

-
- Pro Scripter
- Posts: 50
- Joined: Fri Mar 23, 2007 10:14 am
I've changed the following but with no success:
Let>z=1
Label>files
ReadIniFile>c:\wg09.ini,%archive%,parm%z%,filename
If>filenamefiles
Day>the_day
Month>the_month
Year>the_year
Let>thisday=%the_year%%the_month%%the_day%
FileDate>%source%%filename%,fdate
if>fdate=thisday,zipfile,zipcounter
Label>zipfile
LibLoad>%SCRIPT_DIR%\Ziplib.dll,hZL
LibFunc>hZL,AddFiles,r,%complete%%zipname%,%source%%filename%,9,0
IfFileExists>%source%%filename%,,files
ZIP_Add>%complete%%zipname%,%source%%filename%,9,0,r
LibFree>hZL
Label>zipcounter
let>z=z+1
End>zipcounter
goto>files
End>zipfile
Label>counter
Let>n=n+1
End>counter
GoTo>business
Label>end
Let>z=1
Label>files
ReadIniFile>c:\wg09.ini,%archive%,parm%z%,filename
If>filenamefiles
Day>the_day
Month>the_month
Year>the_year
Let>thisday=%the_year%%the_month%%the_day%
FileDate>%source%%filename%,fdate
if>fdate=thisday,zipfile,zipcounter
Label>zipfile
LibLoad>%SCRIPT_DIR%\Ziplib.dll,hZL
LibFunc>hZL,AddFiles,r,%complete%%zipname%,%source%%filename%,9,0
IfFileExists>%source%%filename%,,files
ZIP_Add>%complete%%zipname%,%source%%filename%,9,0,r
LibFree>hZL
Label>zipcounter
let>z=z+1
End>zipcounter
goto>files
End>zipfile
Label>counter
Let>n=n+1
End>counter
GoTo>business
Label>end
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Do
I.f. *IF* that file exists, add it to the zip file. Otherwise do nothing.
Code: Select all
IfFileExists>%source%%filename%
Zip_Add>%complete%%zipname%,%source%%filename%,9,0,r
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?