5 Replies Latest reply on Mar 26, 2015 2:08 PM by man9ar00

    How to make Applescript open AI then open file then run ExtendScript then close?

    man9ar00 Level 1

      Here's the sample Applescript code I came up with using the scripting guide/reference for CS6 and also doing some online searches:

       

      tell application "Adobe Illustrator"

          activate

          delay 10

          set pfilepath to "/Users/username/Documents/Temp/someFile.ai"

          set pfile to POSIX file pfilepath

          open pfile as alias without options

          delay 10

          do javascript "#include '/Users/username/Documents/Temp/someScript.jsx'"

          delay 1

          quit

      end tell

       

      I just want to open the app (sample here for AI but also nice to do same for Photoshop), open a file, then run ExtendScript file against it, then close after processing. With this sample script, all that works is the app launches. No file opened, no script ran, app doesn't close at end. I see no errors pop up nor anything show up in command prompt.

       

      The sample ExtendScript just triggers an alert popup message for testing

       

      Also to note, the Applescript snippet is executed from Python but I believe where/how it's executed shouldn't matter (except maybe where the error messages might show up). Although in worse case, I'll debug/run through the AppleScript editor.

       

      Any tips on what's wrong here? Or does it look technically correct?