2012-02-26, 07:19 PM
ttfitz Wrote:Well, except for the skip file one, to me those are all errors - not your fault, but still it didn't do what it was expected to do, so an error. Even the skip file one could be seen in some cases as an error, like with Rob for me, since the program created the skip file in the first place. Different errorlevels could be returned for different circumstances, which could be trapped or processed by the user (for example, right now I added testing to make sure comskip has finished before I call imageGrabLite, and haven't had any of the "file in use" problems I had run into before).
Okay, so if you were able to rename, it returns the new name. But what if you couldn't?
I guess it's really of question of what you'd want to do with all those errorlevel values after processing the file and give some explanation why it would be important. As you wrote "if not exist "%1" will tell you if it didn't work and posted code on how to handle the new name. if you wanted to expand it to do further processing maybe change it to things like these
Code:
set newfile=
FOR /F "tokens=*" %%i in ('imageGrabLite --oid %3 --zap2it --rename') do SET newfile=%%i
if exist "newfile goto nextstep
set newfile=%1
:nextstep
dostuff %newfile
or
Code:
set newfile=
FOR /F "tokens=*" %%i in ('imageGrabLite --oid %3 --zap2it --rename') do SET newfile=%%i
if not exist "%1" goto nextstep
rem nscripthelper %1 etc
:nextstep
Martin