Jump to content
Sign in to follow this  
Matthew1344

Run() & Imagemagick question

Recommended Posts

Matthew1344

Okay... I give up... all I want to do is run the Imagemagick command line to resize an image. What am I doing wrong?

For $i = 1 To $CmdLine[0]
    $nextPicPath = $CmdLine[$i]
    ResizePic($nextPicPath)
Next

Func ResizePic($myPicPath)
    $myPathPieces = StringSplit($myPicPath, "\")
    $myFilename = $myPathPieces[$myPathPieces[0]]
    $myCmd = "convert """ & $myPicPath & """ -resize 800 ""C:\Temp\" & $myFilename & """"
    Run($myCmd)
EndFunc

Of course ShellExecute doesn't work either.

However, when I run $myCmd manually, it does work.

Share this post


Link to post
Share on other sites
gamerman2360

Is the convert file in a directory thats in your %PATH% (enviroment variable)? If not, you might want to include the full path to the file in your $myCmd var.

Share this post


Link to post
Share on other sites
ptrex
Matthew1344

Is the convert file in a directory thats in your %PATH% (enviroment variable)?

Yes. I can ConsoleWrite $myCmd, copy and paste to the command line, and it works fine. (from anywhere)

Share this post


Link to post
Share on other sites
Matthew1344

@Matthew1344

Maybe this can help you out.

ImageMagick in AU3

Regards

ptrex

Yeah... I knew about the COM object. I was just hoping to keep it as simple as possible. I've never had any difficulty in running a simple command before.

I plan to use the COM object, but I'm still terribly curious why the above didn't work.

Share this post


Link to post
Share on other sites
Matthew1344

Okay... Yes... the COM component works.

But why doesn't the command line?

Share this post


Link to post
Share on other sites
Matthew1344

What error do you get?

That's just it. There's no error. The conversion simply doesn't happen. The Windows console window pops up briefly, but it's too fast to even produce any visible output.

-Matt

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  

×