1. Where the script completes on the first pass with no errors, i.e., all files have been created
2. Where the script completes within 4 passes, logging errors, but on the final pass all files have been created
3. Where the script runs, logs error(s) on all passes, with at least 1 file missing on the final pass
My problem is that I can't figure out how to make the script differentiate between the items that finished on the last pass and items that failed on the last pass (other than the header). Clearly I am missing something.?
Code: Select all
//Delete Output Files
DeleteFile>C:\Users\OutPut\File 1\*.*
DeleteFile>C:\Users\OutPut\File 2\*.*
DeleteFile>C:\Users\OutPut\File 3\*.*
//Script Variables
Let>loopcounter=-1
Let>Missing=Loop 0 Failed - Retry:%CRLF%
GetDate>vToday
//Loop Counter
Repeat>loopcounter
//"FAILED" Log File
if>loopcounter=4
Message>%loopcounter%
Timestamp>LogFile,%vToday%, FAILED!!!%CRLF%%Missing%
Exit>0
endif
//Exit Script If ALL Files Exist After 1st Try
if>loopcounter=0
IfFileExists>C:\Users\Output\File 1.xls,,Skip
IfFileExists>C:\Users\Output\File 2.xls,,Skip
IfFileExists>C:\Users\Output\File 3.xls,,Skip
Timestamp>LogFile,%vToday%, COMPLETED With No Errors - Yippie!!!%CRLF%
Exit>0
Label>Skip
endif
//Exit Script If All Files Exist BUT Some Download Errors
if>loopcounter>0
IfFileExists>C:\Users\Output\File 1.xls,,Skip
IfFileExists>C:\Users\Output\File 2.xls,,Skip
IfFileExists>C:\Users\Output\File 3.xls,,Skip
Timestamp>LogFile,%vToday%, COMPLETED!! With Loop Failures%CRLF%%Missing%
Exit>0
Label>Skip2
endif
Let>loopcounter=loopcounter+1
//MessageBox
Let>Runcounter=loopcounter+1
Hour>StartHour
Min>StartMin
Let>StopHour=StartHour+2
Let>MSG_STAYONTOP=1
Message>Loop Completion Time = %StopHour%:%StartMin% %CRLF%Attempt No.: %Runcounter% of 4
//Test & Run
IfFileExists>C:\Users\Output\File 1.xls
//Do nothing
else
run>"C:\RunProject.exe" "C:\Users\Projects\File 1.exe"
if>loopcounter>0
Let>Missing=%Missing%(%loopcounter%)File 1 %CRLF%
endif>
endif
IfFileExists>C:\Users\Output\File 2.xls
//Do nothing
else
run>"C:\RunProject.exe" "C:\Users\Projects\File 2.exe"
if>loopcounter>0
Let>Missing=%Missing%(%loopcounter%)File 2 %CRLF%
endif
endif
IfFileExists>C:\Users\Output\File 3.xls
//Do nothing
else
run>"C:\RunProject.exe" "C:\Users\Projects\File 3.exe"
if>loopcounter>0
Let>Missing=%Missing%(%loopcounter%)File 3 %CRLF%
endif
endif
//Pause Loop <<<<Set>30
//Kill RunProject
VBSTART
set wmi = getobject("winmgmts:")
sQuery = "select * from win32_process where name = 'RunProject.exe'"
set processes = wmi.execquery(sQuery)
for each process in processes
process.terminate
next
VBEND
//Close Message Window
IfWindowOpen>Macro Scheduler Message
CloseWindow>Macro Scheduler Message
endif>
//Loop Script "n" Times
Until>loopcounter=4
Thanks as always
k