Is there a selected layer or not?

Hi all

I need a small function that tells me if there is a layer selected or not. Now I always get the active layer, even if it is not selected with this AM Code:

getSelectedLayerId: function()
{
  var ref = new ActionReference();
  ref.putEnumerated( charIDToTypeID('Lyr '),charIDToTypeID('Ordn'),charIDToTypeID('Trgt') ); 
  return executeActionGet(ref).getInteger(stringIDToTypeID( "layerID" ));
},

Thank you in advance!

I think that this problem has been fixed in the latest version of Photoshop, but I have no ' t have so not sure.

Until the most recent, you can use the following code as it checks to see if a single layer is selected by checking the visibility of the layers.

function getSelectedLayersIdx(){
      var selectedLayers = new Array();
      var backGroundCounter = 1;
            if(activeDocument.artLayers.length > 0){
            backGroundCounter = activeDocument.artLayers[activeDocument.artLayers.length - 1].isBackgroundLayer ? 0 : 1;
            }
      var ref = new ActionReference();
      ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("targetLayers"));
      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 15) return selectedLayers ;
       }else{
           if(app.version.match(/^\d+/) > 15) return selectedLayers ;
         var ref = new ActionReference();
         ref.putProperty( charIDToTypeID("Prpr") , charIDToTypeID( "ItmI" ));
         ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
         if(!backGroundCounter){
            selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" )) -1);
            }else{
                selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" )));
                }
     var vis = app.activeDocument.activeLayer.visible;
        if(vis == true) app.activeDocument.activeLayer.visible = false;
        var desc9 = new ActionDescriptor();
    var list9 = new ActionList();
    var ref9 = new ActionReference();
    ref9.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    list9.putReference( ref9 );
    desc9.putList( charIDToTypeID("null"), list9 );
    executeAction( charIDToTypeID("Shw "), desc9, DialogModes.NO );
    if(app.activeDocument.activeLayer.visible == false) selectedLayers.shift();
        app.activeDocument.activeLayer.visible = vis;
      }
      return selectedLayers;
};

Tags: Photoshop

Similar Questions

  • New 3D extrusion of the selected layer appearing not

    As the title says, it does not appear when I right-click on a layer. I have a GTX 980ti. Gyazo - 2085ce869e03691bb2e449b12bd25db1.png

    Well it explain. You have no 3D feature. Only the Standard CS6 does not have 3D versions, later do.

    If the CC, you have a broken installation, and you have to reinstall.

  • Help, please! I can't select the shape I drew with the pentool again... I have the selected layer, but there is no sign of my new shape in my path Panel?  I have been sitting here for days literally and simply cannot make it appear the race that I created

    HI - can help I'm going crazy! !

    I drew a shape with the tool pen (which took me Age..) and I go back an image that I imported, I cannot select once again it.  I can see it in red, but I'm not able to select once again it.  I have the selected layer, but there is no sign of it in my Panel of traces at all.  I tried clicking on the direct Selection tool (about 100 times), I tried the Brush tool.  I've tried everything.  The same thing happened to me the other day...    Please can someone help!  Tania

    It's the plug technique on the subject:

    Using Photoshop | Manage paths

    It contains this point under manage paths:

    When using a shape or pen tool to create a work path, the new path appears as the work path in the tracks Panel. The work path is temporary; You must save it to avoid losing its contents.

    OK, the red, you mentioned is a Stoke you added. Then quick mask is not involved.

  • Action written in CS4 does not work properly in items 11 - contexts the 'selective' layer

    I created an action with the help of Adobe Photoshop CS4, and that it works in CS4.  When I save and load the action in 11 elements, there is a problem with the selective color layer.  The selective color layer is revealed in the stack of layers with the message whereas it cannot be edited b/c it was created in the full version of Photoshop. However, the layer itself has no changes in color/inside.

    In Photoshop, the selective color layer makes the photo look pink.  When I run the action in Elements11, selective color layer doing absolutely nothing to the photo.  I don't have the turned eye "on" to display the layer, and it is on the correct merge options & opacity (normal, 100%).

    If I run the action in Photoshop, save the file with all the layers created by the action and reopen the file in 11 elements, THEN the selective color layer shows its correct pink color.  But when I run the action as an autonomous action in Elements11, is not.

    Can anyone offer help as to why this is happening? Is there something special I need to do to make the action work in 11 elements? My understanding is that he must RUN and create the layers correctly, although some of them cannot be changed in Elements11. However, as it is, is not creating them with the appropriate color.

    Thank you in advance for your help!

    selective color layer is not supported in PSE11. So any stage to edit would result in the error message saying that the layer can not be displayed.

    For your case, I believe that the recorded action starts by creating a selective correction blank adjustment layer and then tries to change and thus translates into a mistake.

    Even the effort to apply the effect by using result of adjustments of image by mistake as the "selective" command is not available.

    I would try to find another way to apply the effect, but I don't know if there is a way to apply an adjustment layer that is not supported by PES

  • When I click on 'File' and then 'new' it keeps open a new file as a layer and not a background. The RGB mode is selected.

    When I click on 'File' and then 'new' it keeps open a new file as a layer and not a background. The RGB mode is selected.

    With the new files to open as a layer and not a background, I'm not able to create multiple layers and it won't let me convert the background layer.

    How what happened. I've used PS yesterday and had no problem. Today, my computer did updates mandatory day and now this.

    Yes. You use the option of Pixel of the Ellipse tool. He's so setting pixels as it is supposed to do without creating a layer.

    Choose the option to the form:

    Also the menu layer > new layer creates layers and paper rolled up at the bottom of your layers palette also creates a new layer. I hope these work.

  • (Layers palette) When selected, layer is highlighted in gray, not blue.

    When I select a layer, it's highlighted in gray (in the layers palette) and I can't change it. My current process to make an editable layer is as follows:

    • Select Layer (shown in gray)
    • Double-click the layer (opens the dialog "Layer Styles")
    • Dialog box close "Layer Styles"
    • Layer is now highlighted in blue and can be edited.

    I am currently running Photoshop CS5.1 on a windows machine that uses Windows 7.

    Any thoughts?

    I just found out the problem. Somehow, I had entered in "Quick mask" mode Everything works normally now.

    Thank you.

  • Can I move all the objects again selected layer without clicking hundreds of layer bars?

    I'm working on a complex illustrator file generated by GIS software. He gave me all kinds of groups of clip & road clip - what I really need, it's just to put all the same coloured polygons on the layer of a high level (unfortunately I can't draw all of my polygons in a group because illustrator doesn't pull these objects out of their existing clipping groups, and the card gets screwed completely upward if I release the clipping masks. With simple cards I have no problem Direct by selecting all of the polygons, I want, selecting their layers in the layers panel, then moving them to a new layer. This card is too complex, because there are hundreds of objects and hundreds of corresponding layers (they are not contiguous, or else I could simply click can be done with it).


    I used select > same > fill type to select all the polygons, I want that on a single layer, but I really hope that I don't have to select all the layers for each item one by one before I can move them to a new higher level layer. Does anyone know if there is a way to moving all the objects in a new layer selected without having to actually click all the layers in the Panel? Completely open to the alternative routes to my desired result!


    Thank you very much.

    Of course, after making the selection drag selection (to the right of the layer) icon on the desired layer. This will move any selected layer to the new layer.

  • keyboard shortcut. (period) disable the classification in the selected layer

    I can't get my keyboard shortcut to disable the selected layer of ranking to work. Windows has the same Mac keyboard shortcut and I'm Windows.

    I use full screen and want to turn off a layer classification but cannot. I have to go back to the main panels and turn off the eyeball for the selected layer.

    Is it me who can not get this keyboard shortcut from. (period) to work?

    If I go on my pad and think that the. (period) is there, I find myself remove the selected layer using what, in my view, could be the. (period) there.

    This keyboard shortcut was reassigned and I use a pdf of Speedgrade obsolete reference? But this one is 10/12/2014.

    Everything could find your question! Re-entered Sg, played with touches of 'standard' period and paved num. Then tried to turn the NumLock... then, rather than being a temp power gimbal, the period key just to delete the layer selected. Not like a rocker... just delete the layer. Had to go back to history (Ctrl/Com - H) back on my bed.

    Then... you can check the status of your caps lock...

    Neil

  • Moves other than the selected layer layers

    After you select a layer by dragging in the image box and move other layers above this layer or folder of the group. The first selected layer is more selected, the affected layer is even if I was just dragging inside the picture of my initial layer box. CS4 Windows

    Two things to check for

    (1) see if the layer is locked.

    (2) If you were moving to the origin of this layer and the latter it does not move, look in the toolbar above and if the automatic selection box is checked.

    When this box is checked, you can select a layer on the image it self. This can be difficult if there is not a lot of clearance between the two layers as a small image on one of the layers. It would be possible to accidentally select the wrong layer when you try to drag. With the box unchecked, then you have to select the layer in the layer panel.

  • When I select print for a message preview mode, I get an error "the selected printer is not found." I can print the message, but I can't preview the output. I have

    I found that someone else has had this problem, but solution of Matt necessary use of the configuration editor. I followed the instructions, but by clicking on the Advanced tab, there was no Config Editor tab in order to execute the next step of the solution. BTW, I look in the console error log and see what: couldn't read the chrome manifest ' queue: / / / C:/Program % program % 20Thunderbird 20(x86) /Mozilla % 20Files / chrome.manifest'. The error itself is small box with Print Preview error as the label and The selected printer is not found as the contents of the box. Any help much appreciated.

    You look under Tools | Options | Advanced | General? In the main menu, which is the traditional one that spans the top of Thunderbird?

  • scheck selection boxes are not displayed in the window options, nor does the scroll bar - why?

    Firefox is very erratic running. Scrolling is choppy at best. Usually, rocking it and descend is too far or no movement at all.
    Also, the scroll bar is black and there is no visible grab buttons to go up or down. Up and down arrows at the top of the bar are also blacked out.
    Selection boxes do not appear in tools, Options. Therefore, it is very difficult to make the custom choices.
    There is a significant delay after clicking 'OK', 'Cancel' or 'Help' buttons-, in fact, other buttons.
    I have 2 Add-ons 'All-in-one Side Bar' and 'Last Pass', no more.

    If I open firefox in safe mode all these problems disappear. Everything moves smoothly and check boxes appear.

    Have you tried to change the default Firefox theme, if you are using another theme?

    Have you tried disabling hardware acceleration?

    All this is in the article link I posted.

    Find out what steps to follow when the problem occurs in Mode without failure of Firefox, according to your original question and follow the links in the next section of the article.

    See also - https://support.mozilla.org/en-US/kb/troubleshoot-and-diagnose-firefox-problems

  • Selection lists does not not on Android FF but work on default browser

    Hi, hoping for help

    Building an online game site that I'd like to work on the mobile and the PC without different versions.

    I find that the selection lists do not open on FF Android or iOS FF-mobile, even if they work fine in the default browser Android and chrome. Could someone help me debug this, or is this a problem in FF?

    Page URL: http://www.HoldingTheBall.com/clubroom.php?logon=1
    To test: load the URL, click on the image of the Guernsey on the middle right, and then try to use one of the selection lists.
    Features of the page: HTML4, CSS, JS, Jquery, Jquery ui, Jquery-touch-punch (by drag and drop on mobile)

    Any suggestions would be greatly appreciated!

    There is no such thing as Firefox iOS. There is Firefox at home, who would have bookmarks Firefox Sync and the history of your iOS device. All the browsers on iOS are based on the iOS stock Safari Webkit.

    That being said on Firefox for Android that I see the behavior you mention. Is it still a question if you disable the div dragging?

  • CM1415fnw-when scanning in color-message "the selected folder is not writable" - scan OK in black and white

    1 HP LaserJet CM1415fnw

    2 mac OSX 10.7.4

    3. message: "the selected folder is not writable" when try to scan in color, scans OK in black and white

    Make sure the registration color scans at is not read-only.  You can do this by right-clicking on the folder and then select Properties.  Ther will be a box with the unalterable words beside him.  Make sure that the check box is disabled.  If the box has a check or anything in this document, click it until there is nothing in the box.  Let me know what happens.

  • HP Pavilion G6-2292SA: selected image is not authenticated

    A few months ago my laptop came with the message 'selected image is not authenticated to' but I just left him because I was in the middle of loads of deadlines United and had no time to try to sort them. I turned on my laptop about once or twice since then to see if there is no change, but he always showed the same message. When I turned it on today to try to sort it's just come up with a white screen, the black light is turned on and when I press like f10 things happens at the bottom of the screen with "F10"... BIOS Setup Options"but that's all that I can see, I can't seen of these 'options '. Pleaaaase help

    @sofiabruna,

    Thanks for posting back.  Here is the link to your maintenance and service guide.  Here the reference numbers and support for hard drives.  Then, you can contact HP shopping for pricing.

    Maintenance and Service Guide

    Here is the link to HP Shopping.

    Thanks again for posting and have a great day.

  • Selection tool is not the tail with images when you drag

    So I had this frustrating thing for a while. When I put my selection tool a video file at first to move to the side or another layer and as soon as, like moving the selection tool a bit, he places automatically the video one layer under my selection tool... So I have to move the selection up to a length of layers tool to adjust it to the left and right on the timeline... Just a fight. I wish that the selection tool has not changed the layer of videos when I moved it left and right... Just stick with the images that I am setting on the im adjustment layer. Check out the video and you will understand what im getting. The selection tool shows a strange looking symbol with an arrow pointing down so I guess it's just a special feature that was accidentally checked the. You just don't know where I can go back to normal. Thank you

    Video:

    Went on the Chat with Adobe and they solved the problem via remote access.

    First on erase my personalized workspaces closed first pro. Then went to my "documents" (I have a mac) 'Adobe' and then click 'Premiere Pro' and moved three files named "6.0" "9.0" and "10.0" in a new folder, that they named "Od." Finally they opened back first. When the box came to put everything in place, they went up to the top of the window and deselected "import the project workspace" under "workspaces". I have opened a project and it fixed the problem. I had to make a new workspace and change some shortcuts custom back, but other that that, it was back to normal.

Maybe you are looking for

  • cannot add tools to bookmark tools in v24

    upgrade to v24 but found bookmark tool icon is missing, tried to add once again. after reboot, missing once again.have to downgrade to 21 now.Why?

  • HP Pavilion A14Ld-550 desktop: this office has a replaceable graphics card?

    The HP Pavilion 550 desktop computer - A14Ld has a replaceable graphics card? I often hear on an integrated graphics card, it is the question that I am trading for this model, and it has 4 GB memory graphics dedicated with AMD Radeon R5 graphics card

  • TC data show the HF peak

    I have a 1102 I read in 32 TC data channels with.  Attached is a screenshot of a band chart showing data and as we see there are HF narrow peaks in the data with a dT of 2 degrees.  I say HF only with regard to the acquisition of 1 Hz rate.  Any sugg

  • Task Scheduler does not work

    I had a tΓches working for the same time do disk cleanup and Disk Defragmenter, but that market now, said "the task image is corrupt or has been tampered with. User_Feed_synchronization-{19C6F9BC-412D-BBF4-9B95D5436B52}"I have not add new programs.

  • BlackBerry smartphones no Option to Load OS

    My Bold 9650 Verizon locked up and now gets stuck in a reboot cycle. At halfway through the cycle, it displays an error screen. What I do on this screen is JVM error Code 534... RAM FS has no... In any case, I followed the steps on the site Web of Bl