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

system.callSystem on mac

Participant ,
Feb 08, 2015 Feb 08, 2015

The CS6 documentation only explains using system.callSystem to start a .exe on a Windows OS but I'd like to use it to start an a program on a mac. I assume this is poosible but the documentation doesn't document it. What would the syntax be (I'm a windows guy so I've never done a lot of command line work on a mac)

TOPICS
Scripting
1.4K
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
Enthusiast ,
Feb 09, 2015 Feb 09, 2015

It's essentially what's available to you if you were to type in commands at OSX's Terminal.  So, you could, for example, use osascript to run an AppleScript that launches an application.  It might look like this in ExtendScript code:

system.callSystem('osascript /path/to/an/AppleScript.scpt');

Then, inside the AppleScript you can launch an app.  Or, you could invoke scripts written in other languages by simply calling their interpreter, for example like:

system.callSystem('php /path/to/file.php');

Whatever script interpreters you have at your command line you can use directly within a system.callSystem() call. 

You can also just write a direct command like:

system.callSystem('echo "Something to a log file" >> /path/to/a/log.txt');

That command would allow your script output log to a file.

Hope that helps,

Arie

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
Enthusiast ,
Feb 09, 2015 Feb 09, 2015
LATEST

This template for is for Mac but you can add few lines and it would work on Windos too:

function OpenApp(url){

var cmd;

cmd = "";

if($.os.indexOf("Win") != -1){

cmd = "explorer " + String(url);

}else{

cmd += (("open \"" + String(url)) + "\"");

}

try {

system.callSystem(cmd);

}catch (e){

alert(e);

}

}

OpenApp("-a safari");

// open -a Adobe\ Photoshop\ CS          // you can use it for Mac

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