Raptor88 Posted November 23, 2009 Posted November 23, 2009 I call ImgBurn from a batch file. Something goes wrong so I close ImgBurn manually by clicking the red X. The Errorlevel code returned is zero indicating a successful operation. Would it be possible to pre-set the Errorlevel to a non-zero code as soon as ImgBurn starts up? Then if the user has to close ImgBurn manually, the Errorlevel returned to the batch file will be non-zero? Thanks, Raptor
LIGHTNING UK! Posted November 23, 2009 Posted November 23, 2009 ImgBurn already has some set errorlevel return values. Your specific problem probably doesn't trigger them - and I believe you have to be using the /CLOSE parameter too for them to be used.
Raptor88 Posted November 23, 2009 Author Posted November 23, 2009 ImgBurn already has some set errorlevel return values. Your specific problem probably doesn't trigger them - and I believe you have to be using the /CLOSE parameter too for them to be used. Hi Lightning, I did find your list of Errorlevel codes by searching prior to starting this thread. My batch file read and write commands are: "C:\Program Files\ImgBurn\ImgBurn" /mode read /src %InputDrive%: /dest "C:\IBurnTmp\ImgBurnTemp.iso" /overwrite yes /eject %EjectDisc% /close /start /waitformedia "C:\Program Files\ImgBurn\ImgBurn" /mode write /src "C:\IBurnTmp\ImgBurnTemp.iso" /dest %OutputDrive%: /speed %BurnSpeed% /verify %Verify% /eject %EjectDisc% /deleteimage No /testmode Yes /closesuccess /start /waitformedia For testing, I create a problem by not putting a disc into the drive. ImgBurn remains on the screen saying there's no media. I close ImgBurn by clicking the red X. The Errorlevel code returned is zero. I was wondering if it's possible for you to immediately set the Errorlevel code to a non-zero value as soon as ImgBurn is run. Then if the user closes ImgBurn manually for whatever reason, the Errorlevel would already be non-zero so batch files would know that the operation was not successfully completed. Thanks, Raptor
LIGHTNING UK! Posted November 23, 2009 Posted November 23, 2009 You (the user) closing the app is not technically a problem. Using /CLOSE instead of /CLOSESUCCESS will set the errorlevel code to say there was an issue (no media). I'm not changing how it works now I'm afraid.
Raptor88 Posted November 23, 2009 Author Posted November 23, 2009 You (the user) closing the app is not technically a problem. Using /CLOSE instead of /CLOSESUCCESS will set the errorlevel code to say there was an issue (no media). I'm not changing how it works now I'm afraid. Hi Lightning, Good enough. I respect your decision. Just as a FYI though, here's the results of my test: ===== EXCERPTS FROM MY BATCH FILE CODE ===== call :DISK_TO_HDD :DISK_TO_HDD "C:\Program Files\ImgBurn\ImgBurn" /mode read /src %InputDrive%: /dest "C:\IBurnTmp\ImgBurnTemp.iso" /overwrite yes /eject %EjectDisc% /close /start /waitformedia :: test echo In disc to hdd, errorlevel returned is %errorlevel% pause goto :EOF ==================== When :DISC_TO_HDD is called, ImgBurn opens but stops with the status line indicating "Device not ready (Medium not present)". I click the red X to close ImgBurn. the test echo displays: "In disc to hdd, errorlevel returned is 0" Then I changed /close to /closesuccess. Ran the test again and got the same errorlevel return code of zero. So it appears that even using /close or /closesuccess causes an errorlevel return value of zero. Not beating a dead horse here and as I said, I respect your decision not to address this issue. It's not a biggie. Just thought I'd let you see my code and my results in case it is helpful in anyway. Thanks for a great program! Raptor
LIGHTNING UK! Posted November 23, 2009 Posted November 23, 2009 /waitformedia would kill it. It should return 1 if it wasn't ready to start the operation when it tried.
Raptor88 Posted November 24, 2009 Author Posted November 24, 2009 /waitformedia would kill it. It should return 1 if it wasn't ready to start the operation when it tried. Hi Lightning, Ahhh, but if I don't include /waitformedia, the user has to wait for the disc drive to recognize the media before pressing the ENTER key to call the ImgBurn program. Otherwise the user gets an error almost everytime he/she runs my batch file since the drive is usually not ready before the user is. With the /waitformedia option, the user never gets an error because of the the drive still getting ready. FYI, I ask the user to insert the disc(s) into the drive(s) as my very first instruction before asking for the user's options, to give the drive as much time as possible to get ready. Since the user will accept the default options 90% of the time, he/she is ready to proceed with the operation well before the drive is ready. I was forced to put the /waitformedia option to make my batch file work properly for most people. I can live with the problem (got no choice...sniff). But if you see fit to look into this problem further, it would be great! Thanks for your time! Raptor
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now