23 Replies Latest reply on Feb 26, 2018 2:42 PM by Silly-V

    "Isolation Mode" and Javascript.

    ADOBEisUSELESS Level 1

      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...

        • 1. Re: "Isolation Mode" and Javascript.
          Larry G. Schneider Adobe Community Professional & MVP

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

          • 2. Re: "Isolation Mode" and Javascript.
            accidental_PhD Level 1

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

            • 3. Re: "Isolation Mode" and Javascript.
              Larry G. Schneider Adobe Community Professional & MVP

              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.

              • 4. Re: "Isolation Mode" and Javascript.
                Qwertyfly... Level 4

                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.

                • 6. Re: "Isolation Mode" and Javascript.
                  accidental_PhD Level 1

                  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.

                  • 7. Re: "Isolation Mode" and Javascript.
                    Larry G. Schneider Adobe Community Professional & MVP

                    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

                    • 8. Re: "Isolation Mode" and Javascript.
                      accidental_PhD Level 1

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

                      • 9. Re: "Isolation Mode" and Javascript.
                        Silly-V Adobe Community Professional

                        isIsolated is talking about Blending mode isolation.

                        • 10. Re: "Isolation Mode" and Javascript.
                          Silly-V Adobe Community Professional

                          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);

                          • 11. Re: "Isolation Mode" and Javascript.
                            accidental_PhD Level 1

                            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.

                            • 12. Re: "Isolation Mode" and Javascript.
                              Larry G. Schneider Adobe Community Professional & MVP

                              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.

                              • 13. Re: "Isolation Mode" and Javascript.
                                SlowMotion Level 2

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


                                Is there a way via extendscript to exit Isolation mode?

                                • 14. Re: "Isolation Mode" and Javascript.
                                  Silly-V Adobe Community Professional

                                  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");
                                     //Stuff afterwards
                                     var fc = new CMYKColor;
                                     fc.cyan = 0;
                                     fc.magenta = 100;
                                     fc.yellow = 100;
                                     fc.black = 0;
                                     doc.pathItems[0].fillColor = fc;


                                  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.

                                  • 15. Re: "Isolation Mode" and Javascript.
                                    Silly-V Adobe Community Professional

                                    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;
                                                    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");
                                                    app.doScript("Action 1", "TEST1", false);
                                    2 people found this helpful
                                    • 16. Re: "Isolation Mode" and Javascript.
                                      djbgraphicdesign Level 1

                                      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}"', 
                                          var VBgo = new File('~/go.vbs'); 
                                      • 17. Re: "Isolation Mode" and Javascript.
                                        Silly-V Adobe Community Professional

                                        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?

                                        • 18. Re: "Isolation Mode" and Javascript.
                                          djbgraphicdesign Level 1

                                          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.

                                          • 19. Re: "Isolation Mode" and Javascript.
                                            Silly-V Adobe Community Professional

                                            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.

                                            • 20. Re: "Isolation Mode" and Javascript.
                                              Trevorׅ Adobe Community Professional

                                              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



                                              • 21. Re: "Isolation Mode" and Javascript.
                                                Silly-V Adobe Community Professional

                                                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.

                                                1 person found this helpful
                                                • 22. Re: "Isolation Mode" and Javascript.
                                                  Trevorׅ Adobe Community Professional

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

                                                  • 23. Re: "Isolation Mode" and Javascript.
                                                    Silly-V Adobe Community Professional

                                                    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!