Isolating a layer (hiding all other layers)

I have started writing my first script but I am struggling to find out how to isolate an active layer.
Part of my script reads;
var doc = app.activeDocument;
doc.activeLayer = doc.artLayers.getByName('mk stone');
at this point I would like to hide all other layers in the document. I will then select one of the RGB channels then unhide the other layers.
I have worked out the selection part. So all I really need to know is how to hide and unhide all other layers.
Any help would be much appreciated.

There will be a number of layers to turn on and off.
The way it works is to create a folder and select a layer with the corresponding name. i.e create a new layerset called "stone set", then select an existing layer in the scene, this would be called "mk stone".
I would then select an individual RBG channel, load the selection and then make the "stone set" the active layer and apply the layer mask to the layerset.
I have got all this working fine. The only problem is when I try it with more than one layer because it just keeps seeing the highest up layer in the stack and reapplying these selections to all layersets.
I need to tell it to make "mk stone"  the only layer shown, make a RGB selection and then return back to the previous visibilty state. I would then apply the layer mask as previously mentioned select another layer "mk brick" hide all other layers make the RGB selection return to the previous visibilty state apply layer mask to the layerset etc....
It would be alot better if it could return to a previous visibilty state as some files I use have certain layers/layersets turned off and would be useful not to turn all these back on. If not I could work in an external file, but ideally in the same. What I really need is exactly the same as 'alt' clicking the the eye icon on a layer and 'alt' clicking to return to the previous state.
Hope this makes sense. Many thanks for any help.

Similar Messages

  • When I uncheck the "Print" on layer options, all other layers disappeared!

    Hi, I received a ai file from one of my clients, she set one of the layers to be not printing just for place holder. And I coudln't see any layers, originally I thought might be the graphic or fonts she's using, so I recreate the file tried to found out what font or graphics. But after I double click the layer, call out the layer options to uncheck the Print, it mess up the whole layer panel. I chatted with Adobe yesterday, the girl asked me to delete my font management plug-in and try. It didn't work. After that I was on hold with another girl from Adobe for 40 mins, she put me on hold most of time, phone got disconnected, never call me back. I was on my 3rd call with them, wait for another hour still didn't get to sort it out. I waste my whole day without getting the answer. Very frustrated.
    I set the cyan circle on the bottom layer with uncheck print setting, after I click ok, on the layer panel every layers are gone. But I still see all the graphics.
    Please help, I'm waiting Adobe to call me back in another hour. And it would be my 4th call with them.
    Thank you and sorry with such a long question.

    hello, could you go to the firefox ''menu ≡ > help ? > troubleshooting information'', copy the contents of that page and paste them here into a reply on the forum? this might give us a clue what is going on...

  • I created a multi-layered Photoshop file and the backgroud layer changed to gray and all other layers whacked out. I tried reopening it and restarting photoshop. What happened to my file?

    I created a multi-layered Photoshop file and the backgroud layer changed to gray and all other layers whacked out. I tried reopening it and restarting photoshop. What happened to my file?

    Your file is most likely toast, but still:
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • How to create a "dummy" layer to link other layers to the dummy.

    Here is my problem:
    I have a bunch of Layers, I want to behave the same way (here scaling, but I had also rotation before). My approach (as used formerly with my 3D applications) is to create a "dummy" layer, where the channnels of the other layers are linked to. For this I used the "Placeholder" item, but rendering obviously got me an error message, because the "placeholder" is intended for other use.
    So my question: How do you solve such a situation the intended way?
    L.

    Found the possible answer by sniffing on other peoples problems: The dummy is called "Null" here!
    Unfortunetly, I cannot offer to myself the 10 points!

  • Viewing Outlook Calender by specified Events / Appointments while hiding all other info

    Hi Guys 
    Anyone out there with any suggestions on how to fliter an outlook Calender by a specific Task / Event, for eg if i want to see for the next month how many Court appearance I have to make and hide all other Events or if I want to filter by 2 or 3 specific
    events. Anyone out there know how I can do this, or if it is even possible in outlook.
    Thanks 

    Hi,
    As Roady says, we can use filter in view settings to filter your results. Or we can click Search Calendar field in the top right of the calendar. Then the Search Tools in Outlook can help you with much further filter search. Please refer to the picture below:
    Hope it helps.
    Thanks,
    Winnie Liang
    TechNet Community Support

  • Is there a way to gather all shape layer and all text layers?

    Hi -
    I have 250 multi-layered PSD (CS5/Win) files.  Each file shows 2 views of a product.  Parts of the product are labels (Text layers with different words). Then Shape layer arrows point from the label Text to the specific point on the product.

    Does this help?
    // move text and solid fill layers to newly created folder;
    // 2011, use it at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
              var myDocument = app.activeDocument;
              var theSet = myDocument.layerSets.add();
              theSet.name = "Labels and Arrows";
              var theLayers = moveLayers(app.activeDocument, theSet);
    ////// function to move certain layers //////
    function moveLayers (theParent, theSet) {
              if (!allLayers) {var allLayers = new Array}
              else {};
              for (var m = theParent.layers.length - 1; m >= 0;m--) {
                        var theLayer = theParent.layers[m];
    // apply the function to layersets;
                        if (theLayer.typename == "ArtLayer") {
                                  if (theLayer.kind == "LayerKind.TEXT" || theLayer.kind == "LayerKind.SOLIDFILL") {
                                            alert (theLayer);
                                            theLayer.move(theSet, ElementPlacement.PLACEATBEGINNING)
                        else {
                                  if (theLayer != theSet) {
                                            moveLayers(theLayer, theSet)

  • Export only a single layer as image without hiding other layers?

    I know I can just make only one layer visible and then save as e.g. PNG. But my question is - do I have to make all other layers invisibile in order to save only my one single layer as image? Or is there a way to save only a single layer (or a few at once) without hiding the rest of them?

    What does export mean in your mind. Remember Photoshop is a document editor not a file editor it only save files from documents,  There is a way to toggle off visible layers but the one you Alt click on visibility icon. Perhaps the scriptlistiner can shed some light on that,  Photoshop will still have to process all layers and you need to toggle the visibility the second time. It sounded to me that you want to do something like Export Layers to Files that is why I suggested that you look at how Adobe programmers addressed the subject.

  • CS4 Actions change "Show Current Layer, Toggle With Others" MIA

    Greetings forumers,
    I have been using Photoshop for years as a hobby and professionally. My employer recently upgraded our Mac Pro Quad-Core Intel Xeon computers to Photoshop CS4. The transition has been mostly painless accept for all the changes to the keyboard shortcuts (I'll live).
    Recently we have come across an issue with one of our customer's workflows that we have not been able to get by using CS4. Or customer has a workflow that we must work within in order to provide them with the artwork files in a way they can use for other processes. The main parts of this workflow involve layer structure and a set of actions that they have been using since Photoshop 7. Our customer uses Photoshop CS3.
    With the transition to Photoshop CS4 in our shop, one line of their action does not function in CS4.
    Show Current Layer
    Toggle With Others
    What needs to happen is at the end of the action all layers need to be turned visible. In CS3, in the layer palette, by Control & Clicking the eye and selecting "Show/Hide all other layers" produced the recorded action 'Show Current Layer, Toggle With Others'. The names of the layers are not recorded. This is good because the action will work on any layer no matter what the name of the layer is. In essence all layers are made visible.
    In CS4 performing the same above clicks produces a recorded action 'Show , ...' The diference is that in CS4 the action is recording the name of every layer that it is showing/hiding. Simply change the name of one of your layers and running the action again produces a verbose error box.
    So any thoughts on how to make visible all layers in a document using an action that will work on any layered file?
    We are constructing our files in CS4 and opening them in CS3 to run the action for our customer as a work around. Or we are manually toggling the visibility, but what fun is that when it used to be automatable?
    Any help would be greatly appreciated.

    You could try this script (CS4 only) to make all layers/groups visible. If it works for you, you could then call it as part of your action.
    selectAllLayers();
    var sl = getSelectedLayersIdx();
    var sLayers = new Array();
    for( var i = 0; i < sl.length; i++ ){
       makeActiveByIndex( [ sl[ i ] ], false );
       sLayers.push( activeDocument.activeLayer.name );
    ShowAllLayers(sLayers);
    function ShowAllLayers(layerNames) {
        var desc = new ActionDescriptor();
            var list = new ActionList();
                var ref = new ActionReference();
       for(var a in layerNames){
                ref.putName( charIDToTypeID('Lyr '), layerNames[a] );
       $.writeln(layerNames[a] );
            list.putReference( ref );
        desc.putList( charIDToTypeID('null'), list );
        executeAction( charIDToTypeID('Shw '), desc, DialogModes.NO );
    function selectAllLayers(){ 
       var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
        desc.putReference( charIDToTypeID( "null" ), ref );
    executeAction( stringIDToTypeID( "selectAllLayers" ), desc, DialogModes.NO );
       function getSelectedLayersIdx(){
          var selectedLayers = new Array;
          var ref = new ActionReference();
          ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
          var desc = executeActionGet(ref);
          if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
             desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
              var c = desc.count
              var selectedLayers = new Array();
              for(var i=0;i<c;i++){
                try{
                   activeDocument.backgroundLayer;
                   selectedLayers.push(  desc.getReference( i ).getIndex() );
                }catch(e){
                   selectedLayers.push(  desc.getReference( i ).getIndex()+1 );
           }else{
             var ref = new ActionReference();
             ref.putProperty( charIDToTypeID("Prpr") , charIDToTypeID( "ItmI" ));
             ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
             try{
                activeDocument.backgroundLayer;
                selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" ))-1);
             }catch(e){
                selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" )));
          return selectedLayers;
    function makeActiveByIndex( idx, visible ){
       for( var i = 0; i < idx.length; i++ ){
          var desc = new ActionDescriptor();
          var ref = new ActionReference();
          ref.putIndex(charIDToTypeID( "Lyr " ), idx[i])
          desc.putReference( charIDToTypeID( "null" ), ref );
          if( i > 0 ) {
             var idselectionModifier = stringIDToTypeID( "selectionModifier" );
             var idselectionModifierType = stringIDToTypeID( "selectionModifierType" );
             var idaddToSelection = stringIDToTypeID( "addToSelection" );
             desc.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelection );
          desc.putBoolean( charIDToTypeID( "MkVs" ), visible );
          executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );

  • Unlocking Background Layer with lots of other layers

    I've been looking at the similar questions, but no script has worked perfectly yet. I have a series of phoshop actions that I run on a regular basis. I have two version of each, one for if there's a locked background layer, and one for when its already been unlocked. Otherwise my actions error.
    I'd like to simplify the process and have a script run that finds any locked layers (ie: background) and unlocks it, even if there are 15 other layers and even if I have another layer selected. It should also run without errors if there are no locked (background) layers to be found.
    I don't know the first thing about writing my own scripts, so can somebody tell me what lines of code I'd need? Thank you Thank you!

    function makeActiveByIndex( index, visible ){
        var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putIndex(charIDToTypeID( 'Lyr ' ), index )
        desc.putReference( charIDToTypeID( 'null' ), ref );
        desc.putBoolean( charIDToTypeID( 'MkVs' ), visible );
        executeAction( charIDToTypeID( 'slct' ), desc, DialogModes.NO );   
    function getNumberOfLayers(){
        var ref = new ActionReference();
        ref.putProperty( charIDToTypeID( 'Prpr' ), charIDToTypeID( 'NmbL' ) );
        ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID( 'Ordn' ), charIDToTypeID( 'Trgt' ) );
        return executeActionGet( ref ).getInteger( charIDToTypeID( 'NmbL' )) ;
    function getProperty( psClass, psKey, index ){// integer:Class, integer:key
        var ref = new ActionReference();
        if( psKey != undefined ) ref.putProperty( charIDToTypeID( "Prpr" ), psKey );
        if(index != undefined ){
            ref.putIndex( psClass, index );
        }else{
            ref.putEnumerated( psClass , charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
        try{
            var desc = executeActionGet(ref);
        }catch(e){ return; }// return on error
        if(desc.count == 0) return;// return undefined if property doesn't exists
        var dataType = desc.getType(psKey);
        switch(dataType){// not all types supported - returns undefined if not supported
            case DescValueType.INTEGERTYPE:
                return desc.getInteger(psKey);
                break;
            case DescValueType.ALIASTYPE:
                return desc.getPath(psKey);
                break;
            case DescValueType.BOOLEANTYPE:
                return desc.getBoolean(psKey);
                break;
            case DescValueType.BOOLEANTYPE:
                return desc.getBoolean(psKey);
                break;
            case DescValueType.UNITDOUBLE:
                return desc.getUnitDoubleValue(psKey);
                break;
            case DescValueType.STRINGTYPE:
                return desc.getString(psKey);
                break;
            case  DescValueType.OBJECTTYPE:
                return desc.getObjectValue(psKey);
                break;
            case  DescValueType.LISTTYPE:
                return desc.getList(psKey);
                break;
            case  DescValueType.ENUMERATEDTYPE:
                return desc.getEnumerationValue(psKey);
                break;
    var doc = app.activeDocument;
    var layerCount = getNumberOfLayers();
    var invisibleLayers = [];
    var loopStart = Number(!doc.layers[doc.layers.length-1].isBackgroundLayer);
    for(var layerIndex = loopStart;layerIndex<=layerCount;layerIndex++){
        if(!getProperty( charIDToTypeID('Lyr '), stringIDToTypeID( 'visible' ), layerIndex )) invisibleLayers.push(layerIndex);
    for(var hiddenIndex=0;hiddenIndex<invisibleLayers.length;hiddenIndex++){
        makeActiveByIndex( invisibleLayers[hiddenIndex], true);
        if(doc.activeLayer.allLocked) doc.activeLayer.allLocked = false;
        if(doc.activeLayer.pixelsLocked) doc.activeLayer.pixelsLocked = false;
        if(doc.activeLayer.positionLocked) doc.activeLayer.positionLocked = false;
        if(doc.activeLayer.transparentPixelsLocked) doc.activeLayer.transparentPixelsLocked = false;
        doc.activeLayer.visible =  false;

  • Scripting: One layer to adjust opacity of other layers?

    Hi there,
    i've a lot of layers in my comp which names start with "POINTER_".
    I would need those layers to fade out at the same time.
    But i can't subcomp them or use stencil alpha.
    I'm sure it is possible to do a script on an adjustment layer that would do just that.
    All it needs to do is enable me to do opacity keyframes on that adjustment layer which are then linked to the opacity to all layers starting with "POINTER_".
    I'm not a scripting guy so it would be awesome if somebody could show me how to do that.
    Thanks a lot!
    cheers,
    Chris

    You don't need a script for it; you need an expression.
    You can very easily link properties between layers with expressions. In this case, you would apply an Expression Effect Slider to your null layer (or just use the opacity property of an adjustment layer). Then alt-click the opacity property for one of your layers and use the pick whip to choose the slider effect or the opacity property of your controlling layer. Now, when you change the value of the one layer, the others follow. You can copy and paste the expression that resulted from your pick whip to the other layers. (You can even choose to copy the expression only and then paste that to the rest of the layers.)

  • I have photoshopp cc, and I am used to photoshop elements. In photoshop it wont allow me to just click on a layer, and have it select that layer . I have to click on the layer in the box that shows all my layers in order to select it. I also want it to no

    I have photoshop cc, and I am used to photoshop elements. In photoshop it wont allow me to just click on a layer, and have it select that layer . I have to click on the layer in the box that shows all my layers in order to select it. I also want it to not only select the layer on the actual project, but put a hashed line around it that allows me to resize it manually, without having to do it in another window. Does that make sense? I cant even get the layer to select. PLEAE HELP. Id also be able to just click on the layer and drag it. It wont let me, and I am confused.

    If you were serious to learn Photoshop, I'd advise you to take Photoshop classes at your nearest community college or some such institution, to take a subscription to lynda.com, to watch all the Photoshop videos at Adobe TV, to google for specific video tutorials on You Tube and for other tutorials in text format.
    Even the Help menu in Photoshop can be a great starting place.
    Don't expect to find in Photoshop the kind of hand-holding features that Elements has and that appeal to beginners and amateurs.

  • When i change one layer, it changes all the layers!

    i duplicate a layer. When i make any changes to the one layer....it makes the same changes to all the layers! it just started doing this. I deleted and reinstalled the app but it continues!
    HELP!

    I always make a copy of the original and make changes on the duplicate layer. I am trying to crop the duplicate. When cropping, it crops all the duplicate layers.....no matter how many i have.
    I've never had a problem before today!

  • How do I subtract the shape of a layer (a scanned shape) from my other layers - but when the shape hasn't been drawn in photoshop

    Im trying to subtract a shape I have previously painted and scanned in from my other layers...can this be done?

    If this is the effect you want, add a white bottom layer, and create a mask of the heart art to drop it out of image layers
    or... do  you want color only in the heat shape and the rest of the page white?

  • I have several layers for this image: Background, Moon, Tree, Grass and Clouds.  When I try to use the Move tool to move the Moon, the tool jumps to the Tree layer.  The same thing happens with the other layers as well (except the background layer).  How

    I have several layers for my image: Background, Moon, Tree, Grass and Clouds.  When I try to use the Move tool to move the Moon, the tool jumps to the Tree layer.  The same thing happens with the other layers as well (except the background layer).  How can I keep the move tool from jumpimg to the Tree layer?

    1. Pre-select (highlight) the layer to move in the Layers panel.  or-
    2. [ALT+Right mouse click]  to select the wanted layer in the image window.
    and maybe
    3. Set the PS option to "Auto-select" a layer with cursor hover.  (can be very confusing!)

  • How can I mask one layer which is enough for other layers?

    Hi,
    I want to know how can I mask an image on one layer which should enogh for other movie clips. Like the following ...
    1) First layer ........................ Actionscript
    2) Mask layer ....................... Rounded rectange with some design
    2) Image layer ...................... Best image (as a background for all other movie clips)
    3) Movie Clips layer .............. 10 Movie clips (which are like slides and will be act like one webpage each)   
    What I want is the mask layer (Layer 2) should be enogh for all the movie clips in layer 3. No need to mask in each movie.
    I tried in the same sequence but it did not work for me.
    How can I do that?
    Thanks.             

    mouse down (and hold down) on the movieclip layer (at the left of your timeline) and slowly move the mouse up until you see that the movieclip layer is indenting to indicate it's going to be masked.

Maybe you are looking for

  • Error 5002 - when trying to access shopping cart in iTunes

    I've noticed some people had this error yesterday & it was apparently resolved, but I'm getting error 5002 today. Is this the same problem? Will it be sorted soon?

  • Storing a position value from the previous frame

    Hey guys, So, I'm trying to assign the X value a null object had at the previous frame so I can continue to subtract a number from it cumulatively. I'm trying to assign it to a variable (prevframe). I'm not sure where I'm going wrong, but the line I'

  • Flash Player not working in 10.6.3 - arghhhh

    Ok so I installed Snow Leopard on my Macbook Pro and since then I haven't been able to get the flash player to work. I've check I have the latest version Adobe Flash Player 10.0 r45, I've reset the cache in Safari. Now I am at a loss what to do next.

  • What does the spotlight bar in my podcast page do ?

    Hi, In my iWeb podcast page, there is a spotlight bar. At first I thought it was for searching words or something in the podcasts, but it leads to a page with no results "powered by .mac" . What does it really do ? Sincerly.

  • Report on bom  from stko and stpo

    hi,           I am working on the bom reprot with the following tables : STKO STPO MARC T460A MAST i need a report on this tables.  i need the function module to establish if it is multi BOM?