I apologize for this error and wasting peoples time on the code which was not accurate.
Correct code follows:
Very sorry again,//Variables
Let>loopcounter=-1
GetDate>vToday
Let>Missing1=FAILED On Loop 0 - Retry:%CRLF%
Let>Missing2=Files Missing:%CRLF%
Let>Path=Z:\VWR
Let>RuntimeHr=0.03
Let>RunTimeMin=RunTimeHr*60
Let>RunTimeSec=RunTimeMin*60
Let>LoopMax=1
Let>LoopTill=LoopMax+1
Let>LogFileLines=-100
Let>SizeLogFile=50000
Let>LogFile=%Path%\Log\VWR.Log
/*=============================================*/
//Delete VWR Output Files
DeleteFile>%Path%\Output\R*.*
DeleteFile>%Path%\Output\Y*.*
DeleteFile>%Path%\Output\Interactive*.*
Wait>10
//Trim VWR Log File to Last "n" Lines - Note: Tail.exe is saved in "C:\Windows\addins\" Directory
FileSize>%Path%\Log\VWR.Log,LogFileSize
If>LogFileSize>%SizeLogFile%
Let>RP_WAIT=1
Run>cmd.exe /c C:\Windows\addins\tail.exe %LogFileLines% "%Path%\Log\VWR.Log">"%Path%\Log\VWR TEMP.Log"
DeleteFile>%Path%\Log\VWR.Log
RenameFile>%Path%\Log\VWR TEMP.Log,%Path%\Log\VWR.Log
Let>RP_WAIT=0
endif
Repeat>loopcounter
Label>TestForProcessComplete
ProcessExists>RunProject.exe,vProc_var
If>vProc_var=True
Wait>0.1
Goto>TestForProcessComplete
EndIf
//Close Message Window
IfWindowOpen>Macro Scheduler Message
CloseWindow>Macro Scheduler Message
endif>
//Test If Files Exist
IfFileExists>%Path%\Output\R_Estimates_a\R_Estimates_a_data_1.csv,,Skip
IfFileExists>%Path%\Output\R_Estimates_b\R_Estimates_b_data_1.csv,,Skip
IfFileExists>%Path%\Output\R_Estimates_c\R_Estimates_c_data_1.csv,,Skip
//Log and Exit Script If ALL Files Exist After "0" Try
if>loopcounter=0
Timestamp>LogFile,%vToday%, COMPLETED With No Errors - Yippie!!! %CRLF%
Exit>0
endif
//Log and Exit Script If ALL Files Exist After 1st -> "LoopMax" Retry
if>loopcounter>0
Timestamp>LogFile,%vToday%, COMPLETED With Errors!!! - Succeeded On Loop #%loopcounter% %CRLF%%Missing1%
Exit>0
endif
//Log and Exit Script If File(s) FAILED After "LoopMax" Retry
Label>Skip
if>loopcounter=LoopMax
Timestamp>LogFile,%vToday%, FAILED After %LoopMax% Retries!!! %CRLF%%Missing2%
MessageModal>FAILED After %LoopMax% Retries!!! %CRLF%%Missing2%
Exit>0
endif
Let>loopcounter=loopcounter+1
Let>Runcounter=loopcounter+1
//Time Calculation & Screen MessageBox - All Attempts
VBEval>DateAdd("s", %RunTimeSec%, now),LoopEndTime
Let>MSG_STAYONTOP=1
Message>Loop Run Time: %RunTimeHr% Hour(s) / %RunTimeMin% Min(s) %CRLF%Loop Completion: %LoopEndTime% %CRLF%Attempt No.: %Runcounter% of %LoopTill%
//Test & Run VWR Scrapes
IfFileExists>%Path%\Output\R_Estimates_a\R_Estimates_a_data_1.csv
//Do nothing
else
run>"C:\Program Files\VWR\RunProject.exe" "%Path%\Projects\R Estimates a.rip"
if>loopcounter>0
Let>Missing1=%Missing1%(%loopcounter%)R Estimates a %CRLF%
endif>
if>loopcounter=LoopMax
Let>Missing2=%Missing2%- R Estimates a %CRLF%
endif
endif
IfFileExists>%Path%\Output\R_Estimates_b\R_Estimates_b_data_1.csv
//Do nothing
else
run>"C:\Program Files\VWR\RunProject.exe" "%Path%\Projects\R Estimates b.rip"
if>loopcounter>0
Let>Missing1=%Missing1%(%loopcounter%)R Estimates b %CRLF%
endif
if>loopcounter=LoopMax
Let>Missing2=%Missing2%- R Estimates b %CRLF%
endif
endif
IfFileExists>%Path%\Output\R_Estimates_c\R_Estimates_c_data_1.csv
//Do nothing
else
run>"C:\Program Files\VWR\RunProject.exe" "%Path%\Projects\R Estimates c.rip"
if>loopcounter>0
Let>Missing1=%Missing1%(%loopcounter%)R Estimates c %CRLF%
endif>
if>loopcounter=LoopMax
Let>Missing2=%Missing2%- R Estimates c %CRLF%
endif
endif
//Pause Loop
wait>RunTimeSec
//"Kill" RunProject.exe
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
//Loop Script "n" Times
Until>loopcounter=LoopTill
EDIT!!!
Is it possible that have a long string name in the test area can somehow confuse the script from executing properly?
This line:
"IfFileExists>%Path%\Output\R_Estimates_\R_Estimates_c_data_1.csv,,Skip" is actually longer in the actual script; ~110 characters. I have truncated the path name and the script seems to execute properly now. Strange???
Again, Thank you all.
k