Highlighted

Identify smart objects from libraries

New Here ,
Nov 04, 2020

Copy link to clipboard

Copied

Hi everyone,

 

I'm writting a script that iterates through all the layers and gathers information about them (name, text, size...). The script automatically opens smart objects and gathers information from the layers inside.

Most of the time the script works just fine but it can get stuck when trying to open smart objects that are linked to libraries. Even if I have access to those libraries.

jonatans92775995_0-1604494403285.png

This is the code that I'm using to open the smartobjects

function openSmartObject (layer) 
{ 
    try
    {
        executeAction(charIDToTypeID('Invs'), undefined, DialogModes.NO);
        app.displayDialogs = DialogModes.NO;
        var doc =  app.activeDocument;
        doc.activeLayer = layer;
        var idplacedLayerEditContents = stringIDToTypeID( "placedLayerEditContents" );
        var desc5796 = new ActionDescriptor();
        executeAction( idplacedLayerEditContents, desc5796, DialogModes.NO );
    }
    catch(e)
    {
        return false;
    }
}


Is there a way to identify layers from libraries so I avoid opening them? 

If not, is there a way to avoid those popups that blocks the execution of the script?

I've already tried displayDialogs = DialogModes.NO; and it doesn't work.

Thanks in advance!

Adobe Community Professional
Correct answer by Kukurykus | Adobe Community Professional

Find on the forum how to use 'smartObject' and 'smartObjectMore' properties, thanks to which probably you can check if SO is linked to library, otherwise you can parse PSD binaries to look for this information.

TOPICS
Actions and scripting

Views

35

Likes

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

Identify smart objects from libraries

New Here ,
Nov 04, 2020

Copy link to clipboard

Copied

Hi everyone,

 

I'm writting a script that iterates through all the layers and gathers information about them (name, text, size...). The script automatically opens smart objects and gathers information from the layers inside.

Most of the time the script works just fine but it can get stuck when trying to open smart objects that are linked to libraries. Even if I have access to those libraries.

jonatans92775995_0-1604494403285.png

This is the code that I'm using to open the smartobjects

function openSmartObject (layer) 
{ 
    try
    {
        executeAction(charIDToTypeID('Invs'), undefined, DialogModes.NO);
        app.displayDialogs = DialogModes.NO;
        var doc =  app.activeDocument;
        doc.activeLayer = layer;
        var idplacedLayerEditContents = stringIDToTypeID( "placedLayerEditContents" );
        var desc5796 = new ActionDescriptor();
        executeAction( idplacedLayerEditContents, desc5796, DialogModes.NO );
    }
    catch(e)
    {
        return false;
    }
}


Is there a way to identify layers from libraries so I avoid opening them? 

If not, is there a way to avoid those popups that blocks the execution of the script?

I've already tried displayDialogs = DialogModes.NO; and it doesn't work.

Thanks in advance!

Adobe Community Professional
Correct answer by Kukurykus | Adobe Community Professional

Find on the forum how to use 'smartObject' and 'smartObjectMore' properties, thanks to which probably you can check if SO is linked to library, otherwise you can parse PSD binaries to look for this information.

TOPICS
Actions and scripting

Views

36

Likes

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
Nov 04, 2020 0
Adobe Community Professional ,
Nov 04, 2020

Copy link to clipboard

Copied

Find on the forum how to use 'smartObject' and 'smartObjectMore' properties, thanks to which probably you can check if SO is linked to library, otherwise you can parse PSD binaries to look for this information.

Likes

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
Reply
Loading...
Nov 04, 2020 0