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

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

Contributor ,
Sep 14, 2017 Sep 14, 2017

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

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?

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

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

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.

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
Community Expert ,
Sep 20, 2017 Sep 20, 2017
replaying recorded javascript code using the scriptListener doesn't always work

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

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

Playing from the ExtendScript Toolkit targeting Adobe Photoshop

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

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