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

[AppleScript] Target Photoshop CC 2015.5?

Advocate ,
Sep 16, 2016 Sep 16, 2016

Copy link to clipboard

Copied

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

TOPICS
Actions and scripting

Views

1.6K

Translate

Translate

Report

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

correct answers 1 Correct answer

Advocate , Sep 17, 2016 Sep 17, 2016

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

Votes

Translate

Translate
Adobe
Community Expert ,
Sep 16, 2016 Sep 16, 2016

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Advocate ,
Sep 16, 2016 Sep 16, 2016

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Advocate ,
Sep 16, 2016 Sep 16, 2016

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Advocate ,
Sep 16, 2016 Sep 16, 2016

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Advocate ,
Sep 17, 2016 Sep 17, 2016

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Engaged ,
Sep 17, 2016 Sep 17, 2016

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

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