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

"Isolation Mode" and Javascript.

New Here ,
Apr 01, 2014 Apr 01, 2014

Copy link to clipboard

Copied

Hi All,

Does anyone know of a way to get out of IsolationMode using Javascript?

I am trying to create a Duplicate of a Selection on a Tempory Layer.

The selection is often quickest to get to by Isolating.

Then running script.

I'm getting this error:

Error 9034: Cannot add a new layer as sibling to 'Isolation Mode' synthetic layer.

->  tempLayer = app.activeDocument.layers.add();

I also have this issue with another Script I use to Save Artwork.

If Isolation Mode is active when script is run, file is saved with non-isolated sections "Dimmed"

Would be nice to "Idiot Proof" the code a little more by getting out of Isolation mode if need be before saving.

Snippet of save code below:

saveName = new File(FilePathAndName);

saveOpts = new PDFSaveOptions();

saveOpts.compatibility = PDFCompatibility.ACROBAT5;

saveOpts.generateThumbnails = true;

saveOpts.preserveEditability = true;

app.activeDocument.saveAs( saveName, saveOpts );

Fingers Crossed there is a way to access "Isolation Mode" using Javascript.

Both scripts are too much for an action.

I can't run action from Javascript... can I? (boo)

and I realy don't want to go down the path of running JS from an Action, then calling VB to call a different action bla bla.

am using CS6 with CC coming soon...

Thanks in advance...

TOPICS
Scripting

Views

5.2K

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

Valorous Hero , Mar 27, 2015 Mar 27, 2015

Okay, for those fortunate to have CS6+ Illustrator, this approach may be a possible workaround since it's cross-platform, and needs to use no pre-programmed shortcut keys as Exit Isolation Mode is recordable from the Layers fly-out menu.

It'll use the layer's name to try and determine if we are currently in isolation mode by the layer's name being "Isolation Mode".  So if there's normal layers named that, it'll be a problem. In addition, it's possible to load an entire action set from a file into

...

Votes

Translate

Translate
Adobe
Community Expert ,
Apr 03, 2014 Apr 03, 2014

Copy link to clipboard

Copied

For CS6 and above you can run an action using ExtendScript.

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
New Here ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

Any clues as to what action we should run to get out of Isolation Mode?

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 ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

Edit your Keyboard shortcuts to add a shortcut for the Exit Isolation Mode. You can then Record the use of the shortcut in an action using Insert menu command from the flyout.

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
Guide ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

This was my question from when I was having trouble accessing my login and created another one with frustration.

I like this answer Larry, Thanks.

I'll have to give it a go when I get some free time. I'm using a very messy work around at the moment and this would be much better.

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 ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

Screen shot 2014-11-20 at 1.13.17 PM.png

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
New Here ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

Sorry, I'm a new CC 2014 extension developer - I don't think I communicated properly. How can I exit Isolation Mode from ExtendScript code?

I can tell when the user is in Isolation Mode by looking at app.activeDocument.activeLayer (strangely, isIsolated is set to false...). I've tried things like setting activeLayer.isIsolated = false, but nothing has worked so far.

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 ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

I'm just wondering if the line before this referring to hasSelectedArtwork is related.Screen shot 2014-11-20 at 1.56.27 PM.png

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
New Here ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

Thanks, but that just deselects everything; it doesn't exit Isolation Mode.

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
Valorous Hero ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

If you do not mind extra saving, doing a save on your document first will exit isolation mode, but keep your selection intact.  (at least with manual saving);

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
New Here ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

Thanks, that's a helpful tip... but it will only work when the user has already saved the file at least once, and I'm not sure doing that behind the scenes is a good idea.

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 ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

Thanks, V. Good to know. I did find out however that by using KBSCs you can use some of the stuff from the flyout menus in an action which I hadn't known before.

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
Contributor ,
Mar 26, 2015 Mar 26, 2015

Copy link to clipboard

Copied

This might be a necro-thread, but I have the same question:

Is there a way via extendscript to exit Isolation mode?

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
Valorous Hero ,
Mar 27, 2015 Mar 27, 2015

Copy link to clipboard

Copied

Yea, turns out, you can save the document! The downside is the upside.

Or, another insane way to try to workaround this, is to record a platform-specific script which you can either write to disk and execute, or manually write and then execute, which will simply send keys to activate the Illustrator's Exit Isolation Mode keyboard shortcut (which you have to assign in keyboard shortcuts), and it will exit the isolation mode. I just tested on Windows, and it worked, even performing actions after exiting the isolation mode.

The same thing can also be done in an equally hefty way, by recording an action that does the same thing ( if possible), and running that from the script in CS6+.  But, I think the problem with actions is that they don't unload when you tell them to?*

Anyways, if you consider executing an external file from extendscript that can punch in the key shortcut as being from "within extendscript", then, the answer is yes, if you want to do something along the lines of the following code:

#target illustrator

function test(){

    var doc = app.activeDocument;

   var scpt = File("C:\\Users\\User\\Desktop\\test_SendKeys.vbs");

   scpt.execute();

 

   //Stuff afterwards

   var fc = new CMYKColor;

   fc.cyan = 0;

   fc.magenta = 100;

   fc.yellow = 100;

   fc.black = 0;

   doc.pathItems[0].fillColor = fc;

}

test();

And the test_SendKeys.vbs file is this:

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.SendKeys "%^(9)"

As my shortcut for exiting Isolation Mode is Ctrl+Alt+9 , I send those keys using the sendkeys | VBScript | SS64.com syntax described there.

EDIT: Forget all this, if you are on CS6+, see next post for CS6+ solution.

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
Valorous Hero ,
Mar 27, 2015 Mar 27, 2015

Copy link to clipboard

Copied

Okay, for those fortunate to have CS6+ Illustrator, this approach may be a possible workaround since it's cross-platform, and needs to use no pre-programmed shortcut keys as Exit Isolation Mode is recordable from the Layers fly-out menu.

It'll use the layer's name to try and determine if we are currently in isolation mode by the layer's name being "Isolation Mode".  So if there's normal layers named that, it'll be a problem. In addition, it's possible to load an entire action set from a file into the Actions palette, and it is possible to unload one action at a time from it, but I don't see a way to delete an entire set. Therefore, this method will always leave a trace on the user Application: an action set called "TEST1".

#target illustrator

function test(){

    if(app.documents.length > 0){

        var doc = app.activeDocument;

        if(doc.layers[0].name == "Isolation Mode"){

            app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

            try{

                app.doScript("Action 1", "TEST1", false);

                if(doc.layers[0].name == "Isolation Mode"){

                    throw new Error("The Exit Isolation Mode action did not successfully play. It may be absent.");

                }

            } catch(e){

                var exitIsolationModeAction = "/version 3"+

                "/name [ 5"+

                " 5445535431"+

                "]"+

                "/isOpen 1"+

                "/actionCount 1"+

                "/action-1 {"+

                " /name [ 8"+

                " 416374696f6e2031"+

                " ]"+

                " /keyIndex 0"+

                " /colorIndex 0"+

                " /isOpen 1"+

                " /eventCount 1"+

                " /event-1 {"+

                " /useRulersIn1stQuadrant 0"+

                " /internalName (ai_plugin_Layer)"+

                " /localizedName [ 5"+

                " 4c61796572"+

                " ]"+

                " /isOpen 0"+

                " /isOn 1"+

                " /hasDialog 0"+

                " /parameterCount 1"+

                " /parameter-1 {"+

                " /key 1836411236"+

                " /showInPalette -1"+

                " /type (integer)"+

                " /value 25"+

                " }"+

                " }"+

                "}";

                var temp = File(Folder.desktop+"/ExitIsolationModeActionFile.aia");

                temp.open('w');

                temp.write(exitIsolationModeAction);

                temp.close();

                app.loadAction(temp);

                app.doScript("Action 1", "TEST1", false);

            }

        }

    }

}

test();

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
Guru ,
Feb 26, 2018 Feb 26, 2018

Copy link to clipboard

Copied

Hi Vasily

Thanks for the snippet it was very useful.

I tried to recreate it with different Action and Set names but didn't know how to recreate the recording from the actions panel.

Can you explain that and at the same time save me the search time of where to find the save aia file.

Thanks again

Trevor

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
Valorous Hero ,
Feb 26, 2018 Feb 26, 2018

Copy link to clipboard

Copied

Well hello there Trevor! If I help you with this, can you help me with this? And MILLIONS of other things?   I am so lost on a lot of stuff

Anyway - No Worries! Check this out, a special tutorial just for this sort of occasion!

We've learned a lot since 2015, including how to remove sets.

Creating a dynamic action to use with app.doScript() method.

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
Guru ,
Feb 26, 2018 Feb 26, 2018

Copy link to clipboard

Copied

Thanks a lot, I'll try look over both posts tomorrow and see if I can help out.

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
Valorous Hero ,
Feb 26, 2018 Feb 26, 2018

Copy link to clipboard

Copied

LATEST

OH, your question was.. where to actually find the .aia files? YOu just use the fly-out menu to save the .aia text file is all!

And yes, if there's a better ID way to parse CSV without it being too slow that would be just great, maybe one day I too shall write some parser, but Andy VanWaggoner's one is the shortest and sweetest I have ever found!

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
Contributor ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

Neat stuff,

The way I enter and exit isolation mode I assign F1 as my keyboard shortcut for entering iso mode and use the send keys vb script for that. And I use the Escape button to get out of isolation mode using the send keys. That way you only need to assign one key, and I find the F1 help key very annoying anyway and I hate accidentally pressing it and having to wait for all that crap to pop up haha.

I have been messing around with the send keys to see if I can get it to play an action using the keys I assign the action to. I am trying to test it on an action I have set on ctrl + F8. For some reason it will switch my cursor to blend mode which is the W key I believe, anyone know why that is happening?

I am aware of app.doScript I am just trying to get around the bug that crashes illustrator when you run app.doScript when the script is saved as an action. (An action that runs a script that runs an action)

function contour(){

    var VB = [

        'Set appRef = CreateObject("Illustrator.Application")',

        'Set WshShell = WScript.CreateObject("WScript.Shell")',

        'WshShell.SendKeys "^{F8}"',

        ].join('\n');

    var VBgo = new File('~/go.vbs');

    VBgo.open('w');

    VBgo.write(VB);

    VBgo.close();

    VBgo.execute();

}

contour();

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
Valorous Hero ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

I do not know much about this bug, but I wonder if it is just logically not allowed in Illustrator. When you run an action, so maybe Illustrator's action-processing is all occupied with an instance, and if an action is attempted to be launched without using the Action "Play Action" command, such as via script, maybe it doesn't like that.

What is the main purpose for your method of having such nested processes? If it's absolutely necessary, could you split up your processes, or have them run asynchronously?

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
Contributor ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

Yea you are probably right it was a shot in the dark. The way I have it now I have scripts followed by actions followed by a different script, it would just be cool to do it all in one script instead of splitting it up because if something goes wrong during the script its easy to catch, but when you have actions in the middle, those go through no matter what. It all works well for the most part I just feel like with one big script I could really idiot proof it.

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
Valorous Hero ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

To split it up and still have the same flow, I think I would try to have the last script called by the first action write & execute a VBscript which has a small delay to make sure Illustrator is free of the "action-processing" and have it call the next action. I wonder if this would work.

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
Valorous Hero ,
Nov 20, 2014 Nov 20, 2014

Copy link to clipboard

Copied

isIsolated is talking about Blending mode isolation.

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