Skip to main content
Known Participant
September 26, 2009
Question

JSX to AppleScript

  • September 26, 2009
  • 2 replies
  • 6371 views

Hello, I was wondering how to have a jsx PS script launch faster by creating an AppleScript application to put in the dock or maybe just something in Automator.

Any ideas?

This topic has been closed for replies.

2 replies

Muppet_Mark-QAl63s
Inspiring
September 27, 2009

For an application to put in your dock you could do something like this very basic example. You just have AppleScript perform your JavaScript text return something when done. This should be saved from 'Script Editor' as 'Application' from the file formats (do NOT use the run only option as this means that the script can't be opened and edited a code protection thing)

set JavaScript to "myTest();

function myTest() {

var docRef = app.activeDocument;

var docWidth = docRef.width;

var docHeight = docRef.height;

var docSize = docWidth + ' x ' + docHeight

return docSize

}"

tell application "Adobe Photoshop CS2"

activate

do javascript JavaScript ¬

show debugger on runtime error

set x to the result

display dialog x giving up after 2

end tell


mazmaxAuthor
Known Participant
September 27, 2009

Hmmm can't understand what this would do

Would it launch the jsx file into PS or is it possilbe to have an all-inclusive application that runs the code as well?

Thanks

Muppet_Mark-QAl63s
Inspiring
September 27, 2009

In the above is a very basic piece of JavaScript which is nothing more than a string of text a far as AppleScript is concerned. This string is then played out by Photoshop as a script. It should return a value to AppleScript to display a dialog about the active documents height & width. The JavaScript can perform a whole process of commands if you want it to. All you are doing here is wrapping a JavaScript inside of an AppleScript application. If you save the above out to app then you can put it in the doc and it will run when clicked. (all-inclusive)

c.pfaffenbichler
Community Expert
Community Expert
September 27, 2009

I avoid AppleScript, so I can’t help You there.

But if it’s just about avoiding having to scroll through the menus to trigger a Script, one can assign the Script a Keyboard Shortcut or record it into an Action.

Or in CS4 put Scripts into Configurator Panels.