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

How to run ps cs4 js script from applescript

Participant ,
Feb 10, 2010 Feb 10, 2010

Hi, I need to call photoshop js from applescript. Here what I have so far:

tell application "Adobe Photoshop CS4"
    activate
    set myScript to "Applications:Adobe Photoshop CS4:Presets:Scripts:_NDF_Ph_saveAsTif.jsx"
    do javascript (myScript)
end tell

and it's compiles, but when runs, gives me "Error 25: Expected: ;." message.

How can I call ps script from as.

Thank you very much for your help.

Yulia

TOPICS
Actions and scripting
577
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
Adobe
Guru ,
Feb 10, 2010 Feb 10, 2010

You have 2 ways either JavaScript supplied as string or as file. If you are going the route of file then you need to coerce your path string to 'alias' this will fail if it does NOT exist. Here are 2 examples. You also have option to pass arguments as list.

-- As String

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

set Doc_Ref to the current document

tell Doc_Ref

do javascript JavaScript ¬

show debugger on runtime error

display dialog the result

end tell

end tell

-- As File

set ScriptPath to (path to applications folder as text) & "Adobe Photoshop CS2:Presets:Scripts:Hello.jsx" as alias

tell application "Adobe Photoshop CS2"

activate

set Doc_Ref to the current document

tell Doc_Ref

do javascript ScriptPath ¬

show debugger on runtime error

end tell

end tell

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
Participant ,
Feb 11, 2010 Feb 11, 2010
LATEST

This is great. I tried the alias one and it works, and I am sure I will be able to use the other one at some point.

Thank you, Mark.

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