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

[AS][CC2017] Relink file in smart object layer

Contributor ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

Hi,

I need to relink an external file, located inside a smart object layer using AppleScript.

Does anyone know if this can be done ? Currently I have ...

tell application "Adobe Photoshop CC 2017"

  tell current document

       set myLayer to my getLayerByName("Example")

       -- Relink external file located inside smart object layer

  end tell

end tell

on getLayerByName(myLayerName)

  tell application "Adobe Photoshop CC 2017"

       tell current document

       repeat with i from 1 to count layers

            set currentLayerName to (name of layer i) as string

            if currentLayerName is equal to myLayerName then

                 return layer i

            end if

       end repeat

       end tell

  end tell

end getLayerByName

Thanks

TOPICS
Actions and scripting

Views

1.5K

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
Adobe
Community Expert ,
Sep 18, 2017 Sep 18, 2017

Copy link to clipboard

Copied

I suppose that by now you have concluded yourself that AppleScript is not popular for Photoshop Scripting among the regulars on this Forum.

Could you do it in JavaScript instead?

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 18, 2017 Sep 18, 2017

Copy link to clipboard

Copied

tmmls, some parts of the PS commands are not directly exposed to the Scripting API via the Document Object Model – we have to resort to ActionManager (AM: a powerful yet unfriendly set of the ExtendScript language).

As far as I know, AppleScript can't deal with AM, so your best option is to look for a JS solution, save it as a snippet in a .jsx file and then "do javascript" passing the file reference – I'm not expert in AppleScript so please check its documentation for the details.

Hope this helps,

Davide

Davide Barranca - PS developer and author
www.ps-scripting.com

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
Contributor ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

Hi Davide,

Thank your for the usefull information. I did some small tests in Javascript and replaying recorded javascript code using the scriptListener doesn't always work.

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
Community Expert ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

replaying recorded javascript code using the scriptListener doesn't always work

Do you mean when played from AS or on its own?

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
Contributor ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

Playing from the ExtendScript Toolkit targeting Adobe Photoshop

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
Community Expert ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

LATEST

Are you sure you copied the complete pertinent code and that the File can support the task?

What is the error message?

Please post screenshots.

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