Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Execute external application with arguments

Contributor ,
Apr 23, 2024 Apr 23, 2024

Hi,

 

Using Extendscript, how do you execute an external executable with arguments?

 

var myFile = new File("Path to app/app.exe 'arg1' 'arg2'"):

myFile.execute();

 

It doesn't seem to be supported.

 

Thanx

 

tm

 

TOPICS
Scripting
439
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 23, 2024 Apr 23, 2024

File() isn't for executing other applications.

 

https://www.google.com/search?client=firefox-b-d&q=javascript+execute+exe+with+arguments

 

Or maybe it is possible to use File():

https://www.ps-scripts.com/viewtopic.php?p=138643&sid=be944028500c9f098ea14b19c48ebe77#p138643

 

Sorry, I'm not JS guy.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 23, 2024 Apr 23, 2024

Possibly with bridgetalk, although I think that is specifically for Adobe products.

If you are on an apple machine, it might be possible by calling an applescript that then calls the executable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2024 Apr 23, 2024

Hi @tmmls , Do you mean you want to open a file in another Adobe application? If that‘s the case you would have to use a BridgeTalk object as @John D Herzog  suggests.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Apr 24, 2024 Apr 24, 2024
LATEST

If you don't mind technology hopping, you can take advantage of InDesign's VBscript:

ExtendScript >> VBScript >> Windows Script Host >> app.exe

E.g. to show a file in Explorer (that would be the external executable).

 

app.doScript(
"CreateObject(\"WScript.Shell\").Run \"explorer /n,/e,/select,"+f.fsName+"\"",ScriptLanguage.visualBasic);

 

I wrote this for CS3 and haven't tested it in a while.

 

Otherwise, your File() could be a shell script or alike that passes on the parameters. Likely that would involve ugly terminal windows, though.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines