Christoph,
Thanks for the speedy reply. I have just tried EXIT and EXIT /b with the 
%ERRORLEVEL%, 
but it seems that ERRORLEVEL is set to 0, irrespective of whether the convert 
command works or not. If I set the EXIT status (ie IF ERRORLEVEL == 0 EXIT 
256), then the calling batch picks up the returned status ok. So maybe the 
issue is in getting a status from convert itself? (If I use Start-Run-CMD and 
then type in the command - ie convert nonExistant.tif newImage.png, I then get 
an error message displayed telling me the file does not exist - BUT the result 
of and immediately following 'echo %ERRORLEVEL%', just gives 0 (zero)).
 
I know that under Linux, if I try to extract a page that does not exist, I get 
an 'error' from convert as would be expected.


----- Original Message ----
From: Christoph P. Kukulies <[EMAIL PROTECTED]>
To: SteveTucknott <[EMAIL PROTECTED]>
Cc: [email protected]
Sent: Monday, 26 June, 2006 11:19:24 AM
Subject: Re: [magick-users] Convert in WINDOWS batch file


On Mon, Jun 26, 2006 at 10:07:33AM +0000, SteveTucknott wrote:
> Good morrow all,
>  
> I need to be able to get the status of  a 'convert' command - I am taking 
> pages from a multi-page tiff and converting each page to png. The program 
> calling this process needs to know when the last page is reached, so I 
> assumed that if I can get the status back to my code, that would tell me.
> At the moment I'm running a command such as:
> cmd /c convert tiff-file[page] png-file
>  
> and I seem to be getting back the status from cmd rather than from convert.
>  
> I have also tried creating a batch file (masterbat.bat):
>  
> cmd /c mybat.bat
> ECHO "MyBAT GAVE "%ERRORLEVEL%
> notepad  c:\tmp\masterbat.bat
>  
> mybat.bat:
> convert -compress NONE -resize x634 C:\tmp\fred[10] c:\\tmp\\image_bat.png
> ECHO "CONVERT GOT ("%ERRORLEVEL%")"
>  
> Just to see what I get back - and it seems that ERRORLEVEL is set to 0 
> irrespective of whether the input file/page exists or not.
>  
> Any ideas as to how I get at the status of the convert command?

You can do something like

c.bat:

convert ...
exit %ERRORLEVEL%


and in the calling .bat:

cmd /c c.bat
echo %ERRORLEVEL%


--
Chris Christoph P. U. Kukulies kuku_at_kukulies.org
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to