Calling a unix shell app from PS javascript

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

rasoetan

Calling a unix shell app from PS javascript

Post by rasoetan »

Hello,

Is there a quick way to execute a unix shell app on mac os from within javascript?


Basically, have an applescript that is called by "osascript". I want to be able to call the the osascript from PS javascript.

Thanks,
Raphael
Paul MR

Calling a unix shell app from PS javascript

Post by Paul MR »

It would depend on your version of Photoshop
Lookup, File.execute(); or if on CS4 system();
xbytor

Calling a unix shell app from PS javascript

Post by xbytor »

On OS X, you have to create a shell script with executable permissions _before_ you run your jsx. It doesn't matter what's in the file. In jsx, you do something like this:

Code: Select all  var script = new File("~/Desktop/myscript.sh");
  script.length = 0;
  script.lineFeed = "unix";
  script.length = 0;
  script.open("e");
  script.writeln("#!/bin/bash");
  script.writeln("osascript ... whatever");
  script.close();
  script.execute();

-X
rasoetan

Calling a unix shell app from PS javascript

Post by rasoetan »

Thanks folks! I have the file.execute working on CS4...could not get the system () to work, but I'm good.

BTW, I had to use some of the Xbytor setup to create the file object before call the fileObj.execute.

Thanks,
Raphael