Jump to content
Sign in to follow this  
tilly

Requested action with this object has failed ImageMagick

Recommended Posts

tilly

Hallow,

Im using the ImageMagickObject.dll for basic testing and i get the error::) The requested action with this object has failed.:

$oImg.Convert("C:\Downloads\autoIT\ImageMagicAutoIt\logo.jpg", "-scale", "60%x", "C:\Downloads\autoIT\ImageMagicAutoIt\logoDDdffD.jpg")

$oImg.Convert("C:\Downloads\autoIT\ImageMagicAutoIt\logo.jpg", "-scale", "60%x", "C:\Downloads\autoIT\ImageMagicAutoIt\logoDDdffD.jpg")^ ERROR

I still am able to get the result im after, but when i build it i get prity much the same error as follows

AutiIt Error

Line-1:

Error: The requested action with this object has failed.

Dose any one else using the ImageMagickObject.dll get the same error?

If so have you got a way around it.

Share this post


Link to post
Share on other sites
DaRam

Hi:

These are guesses since I have not used imagemagik from AutoIt....

1. Since you are using it as a COM Object, is it registered properly?

FileInstall("ImageMagickObject.dll",@SystemDir&"\ImageMagickObject.dll",0)
RunWait(@ComSpec & " /c regsvr32 /s ImageMagickObject.dll",@SystemDir,@SW_HIDE)

2. Does the "60%x" really need the "x"?

Will this work? or work different?

$oImg.Convert("C:\Downloads\autoIT\ImageMagicAutoIt\logo.jpg", "-scale", "60%", "C:\Downloads\autoIT\ImageMagicAutoIt\logoDDdffD.jpg")

Hallow,

Im using the ImageMagickObject.dll for basic testing and i get the error::) The requested action with this object has failed.:

$oImg.Convert("C:\Downloads\autoIT\ImageMagicAutoIt\logo.jpg", "-scale", "60%x", "C:\Downloads\autoIT\ImageMagicAutoIt\logoDDdffD.jpg")

$oImg.Convert("C:\Downloads\autoIT\ImageMagicAutoIt\logo.jpg", "-scale", "60%x", "C:\Downloads\autoIT\ImageMagicAutoIt\logoDDdffD.jpg")^ ERROR

I still am able to get the result im after, but when i build it i get prity much the same error as follows

AutiIt Error

Line-1:

Error: The requested action with this object has failed.

Dose any one else using the ImageMagickObject.dll get the same error?

If so have you got a way around it.

Share this post


Link to post
Share on other sites
tilly

Hi DaRam

Yeah i have reg registered the dll, i use the 60%x for pecentage scaling, and i took it out and just used like in stead widthXheight and i still get an error.

Share this post


Link to post
Share on other sites
DaRam

Hi DaRam

Yeah i have reg registered the dll, i use the 60%x for pecentage scaling, and i took it out and just used like in stead widthXheight and i still get an error.

Ok. :) Do you have a custom error trap that can provide enhanced DLL Error details, if so provide the details.

If not, this is how:

Add this before the ObjCreate("ImageMagick...

$oMyError = ObjEvent("AutoIt.Error", "ComErrHandler")

Then add this Function in your Script:

Func ComErrHandler()
    $HexNumber = Hex($oMyError.number, 8)
    MsgBox(0, "COM Error", "COM Error Details:" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: " & @TAB & $HexNumber & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
    SetError(1)
EndFunc  ;==>ComErrHandler

Share this post


Link to post
Share on other sites
tilly

Thanks for the tip,

the com error details i get is not very helpful but here it is,

----------------------------

COM Error Details:

--

err.description is:

err.windescription is:

err.number is: 80020009

err.lastdllerror is: 0

err.scriptline is: 161

err.source is: ImageMagickObject.MagickImage.1

err.helpfile is:

err.helpcontext is: 0

------------------------------------

hope that helps :$

we know that "error.scriptline is the line"

Share this post


Link to post
Share on other sites
tilly

Ok, i commented out the custom error MSG, and now i dont have any prolbems with it.

What ive done prolby insnt the best way of handling it, but at least it runs in the compled exe now and dosnt display any errors whatso ever.

Edited by tilly

Share this post


Link to post
Share on other sites
DaRam

Thanks for the tip,

the com error details i get is not very helpful but here it is,

That did not help :)

  • Does other calls to ImageMagick work?
  • Does the sequence of parameters matter?
  • What if you supplied an additional dummy parameter?
Other than this, I'm out of ideas.

On an aside, I preferred to use "freeimage.dll" rather than ImageMagick. I found it less invasive, since it can just exist in the same folder as your script and does not need to be registered.

Share this post


Link to post
Share on other sites
tilly

no other calls seem to result in the same error, othe sequences dont help and the dummy params freze the app,

any way its useable now with the custom error handler,

ill lookinto freeimade.dll

thanks for the help

cheers

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×