Isolation mode check

AiScripts
2 min readJul 19, 2022

--

In Adobe Illustrator, only an isolated object or group of objects can be edited in Isolation Mode. All other objects in the document are inaccessible. In scripting also in isolation mode, the scope is limited to isolated objects.

But how do we know if we are in this mode? There are no methods in ExtendScript API. There is a Boolean property of objects isIsolated which can be misleading. It shows the Isolate Blending status of the object in the Transparency panel. This option is used when several objects are blended in color with each other and the lowest objects should not affect this blending.

Meaning of the isIsolated property

How do we check the Isolation mode? Since in Isolation mode we work only with individual objects, it is impossible to create a new Layer in the document. This can be used as a trick to check the current mode. In the try...catch construct we send a command to create a new Layer, if it’s created, we’re not in isolation mode. Otherwise, the command will cause an error, which will tell us that the mode is active. The creation and deletion of the layer is not written to the document history.

alert(isIsolationMode());
function isIsolationMode() {
try {
var tmpLayer = activeDocument.layers.add();
tmpLayer.remove();
} catch(e) {
return true;
}
return false;
}
Let’s try to create a layer

As you can see, the function returned false when we were not in isolation mode of the rectangle and true when we activated it.

--

--

AiScripts
AiScripts

Written by AiScripts

Sergey Osokin. Product Illustrator, Icon Designer, Script Developer (Ai, Ps). Writing about bugs and tricks in Adobe Illustrator scripts

No responses yet