Code to go into Isolation Mode through jsx?

Explorer ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

I am using 

app.activeDocument.layers[0].isIsolated = true;  But this is not working. Please give your inputs.
TOPICS
Scripting

Views

141

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
community guidelines

correct answers 3 Correct answers

Advisor , Jul 11, 2022 Jul 11, 2022
  • isIsolated is note related to isolation mode. 
  • I could go into isolation mode at the layer level by recroding an action and palying it through a script.  When recording the action, select an item or items in the layer in question, go the the Layers panel (Window > Layers), click the dropdown menu in the upper right corner and click Enter Isolation Mode.  To play the action through a script:

 

app.doScript("Action name", "Set name");​

 

Likes

Translate

Translate
Advisor , Jul 12, 2022 Jul 12, 2022

As I said, "isIsolated" is not related to isolation mode.  Disregard "isIsolated". 

 

To test if an item or layer is in isolation mode, test if its parent is named "Isolation Mode".  The item or layer will have to be targeted by name, because they will lose their index.  Example, to test for isolation mode at the level of a layer named "Layer 2":

 

alert(app.activeDocument.layers[0].layers["Layer 2"].parent.name == "Isolation Mode");

 

femkeblanco_0-1657612518702.png

 

Note that if "Layer 2" is not in isolation mode, you will get an

...

Likes

Translate

Translate
Advisor , Jul 13, 2022 Jul 13, 2022

What I understand is that by wanting to "select" path1 you want to assign it to a variable called "triangle".  path1 is a pathItem not a sublayer.  I would do something like this

var lar = app.activeDocument.layers[0];
try {
   var layer1 = lar.layers["Layer 2"];
   if (layer1.parent.name == "Isolation Mode") {
       var triangle = layer1.pathItems[0];
       alert(triangle);
   }
} catch(e) {
    alert(e.message)
}

 

Likes

Translate

Translate
Adobe Community Professional ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

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
community guidelines
Advisor ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

  • isIsolated is note related to isolation mode. 
  • I could go into isolation mode at the layer level by recroding an action and palying it through a script.  When recording the action, select an item or items in the layer in question, go the the Layers panel (Window > Layers), click the dropdown menu in the upper right corner and click Enter Isolation Mode.  To play the action through a script:

 

app.doScript("Action name", "Set name");​

 

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
community guidelines
Explorer ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

Thanks  femkeblanco   

                                    I am able to go into Isolation mode.But now if i want to validate it , that if layer is in Isolation Mode or now. How to do that. Because this code is not working

 if(app.activeDocument.layers[0].isIsolated == true)  
        {
            Log.qaComment("Layer is in Isolation Mode");
        }

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
community guidelines
Advocate ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

Fusion isolée

renl80416020_0-1657608178746.png

alert(selection[0].isIsolated)
selection[0].isIsolated = true;
alert(selection[0].isIsolated)

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
community guidelines
Advisor ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

As I said, "isIsolated" is not related to isolation mode.  Disregard "isIsolated". 

 

To test if an item or layer is in isolation mode, test if its parent is named "Isolation Mode".  The item or layer will have to be targeted by name, because they will lose their index.  Example, to test for isolation mode at the level of a layer named "Layer 2":

 

alert(app.activeDocument.layers[0].layers["Layer 2"].parent.name == "Isolation Mode");

 

femkeblanco_0-1657612518702.png

 

Note that if "Layer 2" is not in isolation mode, you will get an error, because "Layer 2" will not be accessible.  So you will have to manage errors.

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
community guidelines
Explorer ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Hi femkeblanco

                       I have a doubt. If i want to select <path1 >. My code is - 

var lar = app.activeDocument.layers[0];    //This will select IsolationMode layer

var layer1 = lar.layers[0];      // This will select Layer 1 
var traingle = layer1.layers[0];  // This will select sublayer of Layer 1 . 

But last line is not working . Please guide me, where i am wrong.

Daksri_0-1657695199144.png

 

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
community guidelines
Advisor ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

LATEST

What I understand is that by wanting to "select" path1 you want to assign it to a variable called "triangle".  path1 is a pathItem not a sublayer.  I would do something like this

var lar = app.activeDocument.layers[0];
try {
   var layer1 = lar.layers["Layer 2"];
   if (layer1.parent.name == "Isolation Mode") {
       var triangle = layer1.pathItems[0];
       alert(triangle);
   }
} catch(e) {
    alert(e.message)
}

 

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
community guidelines