Skip to main content
4everJang
Legend
August 10, 2014
Question

Executing a program from a script

  • August 10, 2014
  • 1 reply
  • 784 views

Hi all,

Is there a way to run a program (some exe, with optional commandline arguments) from within a script ?

Thanks

Jang

This topic has been closed for replies.

1 reply

Inspiring
August 10, 2014

Hi Jang,

You can use File.execute to run an external exe file.

But you can't provide parameters.

In such cases I always write a temporary batch file and call

new File("foo.bat").execute()

Hope this helps

Markus


4everJang
4everJangAuthor
Legend
August 10, 2014

Hi Markus,

Yes, that would work. It is kind of clumsy, having to write a batch file just because I want to pass a parameter to an existing program, but if there is no other way to do it, it will have to be done this way. I was looking for an existing client that might give me access to certain Windows functions, possibly using an ActiveXObject interface, but there seems to be no such thing in FM extendscript. There is an ActiveXObject in FrameScript, I think, and that does not seem to use a batch file to make it work.

Ciao

Jang

Inspiring
August 10, 2014

Hi Jang,

 

perhaps ExternalObject could be a solution for that. ExternalObject allows ExtendScripts to call functions in C dlls.

So an ExternalObject works as a connector to a world outside of ExtendScripts, with interfaces in both ways.

    

There is an example for ExternalObjects in Adobe\Adobe Utilities\ExtendScript Toolkit CS4\SDK\Samples\cpp.

Don't know if this works or could be a solution for this and I don’t know if my thoughts are in the right direction.

I hope this information is useful nevertheless.

If there is a way, which is easier or if somebody has got experiences with ExternalObjects please let me know.