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

Select group below currently selected group using javascript

Engaged ,
Aug 10, 2022 Aug 10, 2022

Copy link to clipboard

Copied

How its possible to select group below currently selected group using javascript? For example i selected group Left and i need to create script which will automatically select group below (Front).

 

Screen Shot 2022-08-10 at 12.52.04.png

TOPICS
Actions and scripting

Views

234

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

Community Expert , Aug 10, 2022 Aug 10, 2022

Easy if the group is visible and collapsed, keyboard shortcut of OPT/ALT + [ (which can be recorded into an Action or ScriptingListner can record the code).

 

However, if expanded, a script would be required as mentioned by @c.pfaffenbichler 

Votes

Translate

Translate
Adobe
Community Expert ,
Aug 10, 2022 Aug 10, 2022

Copy link to clipboard

Copied

What is the problem? 

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 ,
Aug 10, 2022 Aug 10, 2022

Copy link to clipboard

Copied

I complete some other scripts on currently active group (left) and i want to move on a group bellow (front) but i dont know how? P.S. Names of groups are not always same.

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 ,
Aug 10, 2022 Aug 10, 2022

Copy link to clipboard

Copied

Do you want to work with DOM code or AM code? 

• In the first case you could iterate through the activeLayer’s parent’s layerSets (unless you also want to select the next-lower groups outside the group’s parent). 

• In the latter case you could get the itemIndex of the selected Group and then work down from that until you hit the next layerSectionStart after the layerSectionEnd of the selected group. 

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 ,
Aug 10, 2022 Aug 10, 2022

Copy link to clipboard

Copied

Easy if the group is visible and collapsed, keyboard shortcut of OPT/ALT + [ (which can be recorded into an Action or ScriptingListner can record the code).

 

However, if expanded, a script would be required as mentioned by @c.pfaffenbichler 

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 ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

Thanks, i copy this shortcut from SL and it works ok

var idselect = stringIDToTypeID( "select" );
    var desc23 = new ActionDescriptor();
    var idnull = stringIDToTypeID( "null" );
        var ref18 = new ActionReference();
        var idlayer = stringIDToTypeID( "layer" );
        var idordinal = stringIDToTypeID( "ordinal" );
        var idbackwardEnum = stringIDToTypeID( "backwardEnum" );
        ref18.putEnumerated( idlayer, idordinal, idbackwardEnum );
    desc23.putReference( idnull, ref18 );
    var idmakeVisible = stringIDToTypeID( "makeVisible" );
    desc23.putBoolean( idmakeVisible, false );
    var idlayerID = stringIDToTypeID( "layerID" );
        var list13 = new ActionList();
        list13.putInteger( 553 );
    desc23.putList( idlayerID, list13 );
executeAction( idselect, desc23, DialogModes.NO );

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 ,
Aug 12, 2022 Aug 12, 2022

Copy link to clipboard

Copied

@milevic – fantastic, that is how one starts! The following steps are realising that this can be put into a function and swapping out hard-coded values for variables... Then you'll have a single function that can use a parameter to select either forwards or backwards. I only mention this as it took me a little while before this became obvious (as I am self-taught with no formal JS or programming background).

 

By itself, this will have problems with an expanded group with child content or non-visible layers. But as long as the groups are collapsed and visible, there shouldn't be any issues.

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 ,
Aug 15, 2022 Aug 15, 2022

Copy link to clipboard

Copied

LATEST

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