How to get an IM command to the console and run?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

How to get an IM command to the console and run?

Post by holden »

I have a vbscript written that takes instructions from a table and generates an IM command. I need to now run the IM command automatically- I thought I had this solved using .bat files but that won't work. Any ideas? I understand that there is some wip code for v7 happening, but a solution is needed sooner than the release date. Thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to get an IM command to the console and run?

Post by snibgo »

snibgo's IM pages: im.snibgo.com
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: How to get an IM command to the console and run?

Post by holden »

I've tried that and many variations, and nothing works- it's a common theme that those commands do nothing in the threads I have read through (and I have tried probably 40 iterations of it). I think the big issue may be setting permissions, and to have loose permissions that allow .bats to run does not seem like a good idea. Is there an alternative to a bat file?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to get an IM command to the console and run?

Post by snibgo »

I'm not sure what you are asking. But I don't know VBscript, so I probably wouldn't know the answer.

Pasting this into a file called test.vbs ...

Code: Select all

Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("cmd /c %IM%convert -version")
Do While Not objExecObject.StdOut.AtEndOfStream
  strText = objExecObject.StdOut.ReadLine()
  Wscript.Echo strText
Loop
... then typing "test.vbs" at the command prompt works for me.

(Note: IM is an environment variable that points to a location for convert.exe.)
snibgo's IM pages: im.snibgo.com
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: How to get an IM command to the console and run?

Post by holden »

then typing "test.vbs" at the command prompt works for me.
The thing I am trying to avoid is typing into the command line, I would rather have some automation of that part (I know this isn't the ideal forum to ask but so far the search has been fruitless). Basically vbscript generates the IM command which then *poof* runs in the console. I may have to look into some 3rd party software for a hot folder utility
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to get an IM command to the console and run?

Post by snibgo »

Well, something has to kick off the process: an image file is dropped on to a file, or into a directory, or something else. The file could be a BAT, C program or (I suppose) a VBS. For a directory, you could have a daemon program in C that autostarted on power-up then did nothing until receiving an interrupt from a directory change.

But such mechanisms are not feasible from within IM, the subject of these forums.
snibgo's IM pages: im.snibgo.com
Post Reply