6 Replies Latest reply on Sep 17, 2016 6:11 PM by mauricior6328708

    [AppleScript] Target Photoshop CC 2015.5?

    DBarranca Level 4

      I'm doing a bit of AppleScript automation and I'm completely stuck at square one.

      This works flawlessly:

       

      tell application "Adobe Photoshop CC"

        do javascript file ("/Users/davidebarranca/Desktop/pippo.jsx")

      end tell

       

      (if you wonder, pippo.jsx just alerts "PIPPO")

       

      This breaks miserably (merely added 2015.5):

       

      tell application "Adobe Photoshop CC 2015.5"

        do javascript file ("/Users/davidebarranca/Desktop/pippo.jsx")

      end tell

       

      With the following error: Syntax Error – Expected end of line but found identifier.

      And it selects the "javascript" word.

      I've been banging against this wall for one hour – what the heck is happening?!

       

      I've tried to run this script in the Terminal:

       

      sleep 5; osascript -e 'tell application "System Events"' -e 'set frontApp to name of first application process whose frontmost is true' -e 'end tell'
      

      You run it, then you have 5 seconds to switch to Photoshop, and then Terminal will log the Application name, which is – guess what – "Adobe Photoshop CC 2015.5".

       

      So why on earth those 3 lines of applescript are wrong?! They're driving me nuts :-)

      Thank you,

       

      Davide Barranca

        • 1. Re: [AppleScript] Target Photoshop CC 2015.5?
          pixxxel schubser MVP & Adobe Community Professional

          Hi Davide,

          in [JS] you can call the version Photoshop CC2015.5 with

          #target photoshop-100.064

          or more simple

          #target photoshop-100

           

          For CC2015 you need

          #target photoshop-90.064

          or more simple

          #target photoshop-90

           

          Perhaps you can do the same in Applescript? I don't know.

           

          Have fun

           

          • 2. Re: [AppleScript] Target Photoshop CC 2015.5?
            maxwyss Level 4

            I am doing quite a few (Photoshop) JavaScript calls out of Applescript, and I explicitely state that it is a POSIX file, and I also set the file spec in parentheses. Your example would then look like this:

             

            tell application "Adobe Photoshop CC 2015.5"

              do javascript (file (POSIX file ("/Users/davidebarranca/Desktop/pippo.jsx")))

            end tell

             

            and this is stable.

             

            If Photoshop CC 2015 is not installed when CC 2015.5 is present, I can even tell the application "Adobe Photoshop CC 2015" to do stuff, and it will do that correctly.

            • 3. Re: [AppleScript] Target Photoshop CC 2015.5?
              DBarranca Level 4

              Thanks for your replies, my comments below:

               

              pixxxel schubser: the AppleScript way is exactly 'tell application "AppName"'. In fact for "Adobe Photoshop CC" the little script works flawlessly.

               

              maxwyss: I've tried adding POSIX, but no luck. By the way, using "Adobe Photoshop CC" without POSIX works fine anyway, so it should "Adobe Photoshop CC 2015.5"

               

              Let's reformulate with a simpler code:

               

              # Working

              tell application "Adobe Photoshop CC"

                do javascript "alert('boo')"

              end tell

               

              and:

               

              # Broken

              tell application "Adobe Photoshop CC 2015.5"

                do javascript "alert('boo')"

              end tell

               

              What the heck is going on there?!

              Thanks,

               

              Davide

              • 4. Re: [AppleScript] Target Photoshop CC 2015.5?
                DBarranca Level 4

                I've been able to track the root cause of the issue – not been able to solve it, though.

                 

                I can't run AppleScript invoking Photoshop versions that I also happen to have in my Parallels virtualized Windows 10.

                So to speak, Parallels "steals" them from OSX.

                 

                In fact, if I:

                 

                set doesExist to false

                try

                  do shell script "osascript -e 'exists application \"Adobe Photoshop CC\"'"

                  set doesExist to true

                end try

                 

                return doesExist

                 

                It returns TRUE; while if:

                 

                set doesExist to false

                try

                  do shell script "osascript -e 'exists application \"Adobe Photoshop CC 2015\"'"

                  set doesExist to true

                end try

                 

                return doesExist

                 

                It returns FALSE. Countercheck:

                 

                set appID to id of application "Adobe Photoshop CC"

                 

                is "com.adobe.photoshop", while:

                 

                set appID to id of application "Adobe Photoshop CC 2015"

                 

                is "com.parallels.winapp.ba6ce4f563fc495390502afab876d865.e76675ef6e5847ae8f396c55f9ff2f09"

                 

                So I'm currently unable to use CC 2015 and CC 2015.5 via AppleScript because they're sort of missing, because "stolen" by Parallels.

                I've contacted their tech support – I hope they'll be able to tell me how to set things back to normality – has anyone of you ever had to do such a thing?

                Thank you in advance,

                 

                Davide

                • 5. Re: [AppleScript] Target Photoshop CC 2015.5?
                  DBarranca Level 4

                  Problem solved.

                   

                  Recap: I'm using Windows 10 virtualized with Parallels Desktop on my Mac, and Windows has "stolen" some Photoshop versions (the one I've installed also on the PC side) from OSX – that's the reason why AppleScript fails: it can't find Photoshop.

                   

                  Solution: I had to disable application sharing:

                   

                  DB 2016-09-17 at 19.34.55.png

                   

                  Probably I could leave "Share Mac applications with Windows" on, but I don't need it anyway.

                  I hope this is going to save some hours-thrown-down-the-toilet to somebody else in the future.

                   

                  Davide

                  • 6. Re: [AppleScript] Target Photoshop CC 2015.5?
                    mauricior6328708 Level 1

                    I do not use mac ... But I think here hundreds of users use and sure enough, it will be useful to many. Thank you for sharing Davide.