Apply selection to layer mask

Hello,
iam looking for a solution to apply a previeuws
selction to a layer mask of a adjustment layer.
My code mange to select the mask - but when i apply the
selection it creates layer above.
I need to go into the layer mask (alt and click) and then paste.
Then go out.
Scriptlistender isnt helping so much.
app.activeDocument.selection.selectAll(); //selects stuff on the preview layer
app.activeDocument.selection.copy();  //copy that stuff - to paste it into the mask later
var adjLayer = doc.layerSets.getByName("ao").artLayers.getByName("ao");  //searching for a group and specific layer
var mask = ExtendedLayer.selectLayerMask(adjLayer); // extern function wich selects the mask (does not go "into" the mask - just selects it)
pastMask = function()
// Selectin recorded by Script listender
var idslct = charIDToTypeID( "slct" );
    var desc321 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref212 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idChnl = charIDToTypeID( "Chnl" );
        var idMsk = charIDToTypeID( "Msk " );
        ref212.putEnumerated( idChnl, idChnl, idMsk );
    desc321.putReference( idnull, ref212 );
    var idMkVs = charIDToTypeID( "MkVs" );
    desc321.putBoolean( idMkVs, false );
executeAction( idslct, desc321, DialogModes.NO );
// paste, recorded by script listender
var idpast = charIDToTypeID( "past" );
    var desc322 = new ActionDescriptor();
    var idAntA = charIDToTypeID( "AntA" );
    var idAnnt = charIDToTypeID( "Annt" );
    var idAnno = charIDToTypeID( "Anno" );
    desc322.putEnumerated( idAntA, idAnnt, idAnno );
executeAction( idpast, desc322, DialogModes.NO );
pastMask();
Any help would be really nice.!
Thanks alot
Alpha

app.activeDocument.selection.selectAll(); //selects stuff on the preview layer 
app.activeDocument.selection.copy();  //copy that stuff - to paste it into the mask later 
var adjLayer = activeDocument.layerSets.getByName("ao").artLayers.getByName("ao");  //searching for a group and specific layer 
activeDocument.activeLayer = adjLayer;
pastMask = function() 
// Selectin recorded by Script listender 
var idslct = charIDToTypeID( "slct" ); 
    var desc321 = new ActionDescriptor(); 
    var idnull = charIDToTypeID( "null" ); 
        var ref212 = new ActionReference(); 
        var idChnl = charIDToTypeID( "Chnl" ); 
        var idChnl = charIDToTypeID( "Chnl" ); 
        var idMsk = charIDToTypeID( "Msk " ); 
        ref212.putEnumerated( idChnl, idChnl, idMsk ); 
    desc321.putReference( idnull, ref212 ); 
    var idMkVs = charIDToTypeID( "MkVs" ); 
    desc321.putBoolean( idMkVs, true ); 
executeAction( idslct, desc321, DialogModes.NO ); 
// paste, recorded by script listender 
var idpast = charIDToTypeID( "past" ); 
    var desc322 = new ActionDescriptor(); 
    var idAntA = charIDToTypeID( "AntA" ); 
    var idAnnt = charIDToTypeID( "Annt" ); 
    var idAnno = charIDToTypeID( "Anno" ); 
    desc322.putEnumerated( idAntA, idAnnt, idAnno ); 
executeAction( idpast, desc322, DialogModes.NO ); 
pastMask();

Similar Messages

  • How to select a layer mask (not its contents) and another layer/folder at the same time?

    I can do one or another, but both at the same time?
    It is annoying because a mask selection turns into layer selection when you select a second layer/folder.

    Well a layer mask is just that for that layer. If you want to apply that mask to a new layer, you can drag it or alt drag to drag a copy to the new layer. Then it will have its own layer mask. When your done, if needed you can then remove that mask from that new layer, if for some reason you only wanted to see a temporary mask.

  • Selecting a layer mask?

    Somehow I set something in PS CS 5 that is not allowing me to click on the layer mask to select it. I can select the mask via the mask panel but that's annoying and I would really like to figure out what I set to reset it back to the normal way I work. This does not seem to be set off for photoshop in general as I can open some files and can select  the mask via rolling the curser over it and clicking, but there are specific images I am working on currentily that seem to have this setting applied to them.  Any ideas or suggestions would be very appreciated. 
    thanks,  jeff

    Layers palette flyout menu >> layer panel options >> choose a larger thumbnail
    can you slect the mask now.
    Can you cmd click on a layer mask, to select the pixels.

  • Can't select or edit layer mask in CS5.1 extended

    In our class, we have photoshop CS5 on MACs
    I  started a project in class which involves creating a layer mask. I was about done with the mask, but  brought it home to finish. I opened the file on my WIN XP running  photoshop CS5.1 extended, which I installed this morning. In class I was  able to click on the mask to select it, then use the brush to edit the  details, painting black or white as needed to refine the edge.
    When I brought the .psd file home and opened  it in the newer version of Photoshop, it won't allow me to select the  mask for editing. I selected the layer then clicked on the mask thumbnail in the layer pallette but didn't see the corner  outlines that usually show when the layer thumbnail is selected. When I  tried brushing on what I thought was the mask (of the layer selected) I  got the pink overlay as is usually seen in quickmask. (fore and  background colors were black and white).
    Does v5.1 behave  differently with masks from v5.0? I didn't change any of the factory  default settings and in class it is standard practice to reset to the  default when we begin.
    any ideas?

    sweet. That did the trick Noel.
    I didn't turn quickmask on. I just loaded the file from my flash drive and first thing I tried was to select the layer mask. I'll have to try another file to see if PS is starting in quickmask mode itself.
    I had an inkling I was in quickmask mode from the pink painting, but hadn't selected it and didn't know about the q hotkey. newbie here just a few weeks into the intro course.
    again, thanks for the fast reply. I just might be able to finish this assignment yet tonight.

  • Can't select layer mask, also some tools not working -- in CS2

    Photoshop 9.0.2 on WinXP Pro (3 GB RAM; Used space: 18.4GB; Free space: 214GB; Video card: 256MB ATI Radeon X1300PRO)
    Hi, I have a couple image layers (each created by merging several others) that each also have a mask attached. I cannot get the layer mask selected on either one. I have found that I can delete the layer mask, and start with a new one and make edits, but it is a one-time shot: once I de-select it I cannot get back to it to make any further changes. (I have only a standard mouse, not a Wacom tablet/pen mouse, nor does anyone nearby, or perhaps even in the building. See: http://www.adobeforums.com/webx/.3bbfe832 )
    Also, when I have the layer selected and try to draw on it (in black) with the Brush tool, it paints red. Then I was able to Erase the red brush strokes just a minute ago without disturbing the integrity of the image. However, I just tried it again and more red was painted onto the image layer (in the currently assigned size of the Eraser).
    Incidentally, yesterday and this morning I couldn't get the Eraser tool to do *anything* at all.
    Everything I *can* do does show up in the History palette.
    I also just happened to notice that when I select any layer in the doc that the small frame appears around the thumbnail to indicate it is selected, but that the entire row itself does not become highlighted as it normally does. And when I check the eye to make the layer disappear, the red brush strokes (both from the Brush and Eraser) still show.
    I generally work on a network, but after I started having these problems I moved the file to my desktop and have worked from there since early yesterday with apparently increasingly odd issues. I have a co-worker who experienced the same inability to select the layer mask a couple days ago, but his system has since returned to "normal" (and while continuing to work across the network). Thanks!

    >, but obviously need to brush up on the details.
    you really should. imo, the quick mask is one of the best and most flexible selection tools available in photoshop! you should either check out the help on it (F1) and/or google for some tutorials.
    I set mine (double click the quick mask icon in the tool bar) so that painting black paints a "selection" rather than a "mask" (painting white clears the selection). in that way, the quick mask tool in effect becomes a quick selection tool that can take advantage of all your various brushes and brush effects (opacity, flow etc.) when making or adjusting selections.

  • Copy and paste layer mask into another layer mask

    I know there is a way to do this.
    How can I copy and paste on layer mask into another.
    I need to use the same mask for multiple layers and images.
    Thanks

    In the same document, click on the layer mask, option drag to a new layer
    To copy mask to a different document with both documents open, select the layer, Duplicate Layer to the other document (destination). Then in the other document, option drag the mask to whatever layer you want, delete the layer you duplicated (you don't need it anymore, you just needed the mask)
    Or to copy mask to a different document with both documents open, load mask as a selection. Save selection to the other document (destination). Then in the other document load the new alpha channel and apply as a layer mask. Delete the alpha, you don't need it anymore.
    Edit: J always beats me to it

  • Please help with Layer Mask

    I have been painting in Photoshop using layer masks. Using the pen tool I would outline my image, control>R-click>select create layer mask, then I would paint as desired. When doing so it would create a grey layer mask background in the layers window and everything would work100%. But now all of a sudden when I do this process the layer mask square turns white and it seems as the mask I have created is inverted. I paint everything but the mask I want. I have no clue how to turn it back to the original grey colour I was using. Please help.

    Using the pen tool I would outline my image, control>R-click>select create layer mask,
    So are you using a Vector Mask or a Layer Mask?
    Could you post a screenshot?
    What are the Paths’ Area settings?

  • Bug report: [layer mask] editing colors

    Sometimes it appears that the white/black color combination that is automatically selected in layer mask editing may override the selected color combination outside of layer mask editing.
    Example:
    1) Open Photoshop.
    2) Select two colors: white/white.
    3) Create two blank documents, each with an empty Layer 1.
    4) In one document, add a layer mask to Layer 1. The colors should have been automatically switched to black/white as the layer mask is selected.
    5) In this document, use the gradient tool to fill the layer mask with black/white.
    6) Switch to the other document, and notice that the color selection is again white/white.
    7) In this other document, use the gradient tool to fill Layer 1. Notice that the layer is filled with black/white instead of white/white as selected.
    Tested on: PS CS6, Windows 7, 64-bit.

    On further testing I think the issue may not be directly related to layer masks at all.
    Basically the issue is that the Gradient tool colors don't update to the 'default foreground/background colors' in cases where it seems that they should.
    One example of such a case (as illustrated in the original post) is when the Gradient tool keeps the black/white color combo used for a layer mask in a previous document after switching to the current document where a non-masked layer is targeted and the default fg/bg colors have correctly reverted to white/white.
    Example:
    layer mask targeted in doc1 - notice synchronised Gradient and default fg/bg colors
    after switching to non-masked layer in doc2, Gradient is still black/white although default fg/bg colors have reverted appropriately to white/white
    Bug or not, it's something I wanted to point out as it seems inconsistent.

  • Adjusting settings in Refine Edge after outputting new layer mask?

    After using Refine Edge in CS5.5 and removing the background from an image, I set it to output as a new layer mask. Next I place the image on top of a background and see that it needs some additional adjustments. How do I now get back to the Refine Edge window where I can see the changes I made previously and modify some of the settings? When I reopen the Refine Edge window the settings from before are no longer there.
    Thanks.

    You need to select the layer mask, and use refine Mask rather that Refine edge.  There is an excellent tutorial by Martin Evening here
    http://www.youtube.com/watch?v=ssJRkbkHAa4

  • Delete layer mask and not image?

    I create a layer mask on a layer and then I duplicate the layer and I want to delete the layer mask on the duplicate layer, though keep the image part. I select the layer mask and hit delete, though it deletes everything on the layer. How can I keep the image portion of the layer?
    Thanks.

    There are several ways including dragging the layer mask to the trash icon
    at the bottom of the layers panel (pick delete in the dialog that pops up)
    or right clicking on the layer mask and choosing Delete Layer Mask.
    MTSTUNER

  • Loading a layer mask as Selection in Script

    If you have a layer (Layer 1), that has a mask on it, if you look at the Channel list in Photoshop, you will see a channel named "Layer 1 Mask" of which you can load the selection using the "Load Selection..." dialog.
    If a layer has a mask, even if the layer is the active layer, the mask is not a channel object in script. At least, it not exposed.
    activeDocument.channels.length returns the number of component channels plus any alpha channels. In an RGB image with only the layer mask it returns 3.
    activeDocument.channels.getByName("Layer 1 Mask") throws an error.
    So I don't see a way to tell if a layer already has a mask or how to load that mask as a selection, apply or discrad the mask, or turn the mask off without using scriptlistner.
    I personally am using C#, and I tried the following which worked:
    curDoc.Selection.Load(curDoc.Channels["Blue] ,null, null);
    But this doesn't:
    curDoc.Selection.Load(curDoc.Channels["Layer 1 Mask"] ,null, null);
    Any help would be appreciated
    Carl

    As far as I know scriptlistner is the only way to deal with a layer's channel masks. A vector mask is part of the pathItems collection when the layer is active.

  • Want to apply layer mask

    Hello all
    when i open the image
    i want to change background layer and name it source
    after i want to apply layermask selection from path

    So create a Reveal All-Layer Mask
    var idMk = charIDToTypeID( "Mk  " );
    var desc166 = new ActionDescriptor();
    var idNw = charIDToTypeID( "Nw  " );
    var idChnl = charIDToTypeID( "Chnl" );
    desc166.putClass( idNw, idChnl );
    var idAt = charIDToTypeID( "At  " );
    var ref97 = new ActionReference();
    var idChnl = charIDToTypeID( "Chnl" );
    var idChnl = charIDToTypeID( "Chnl" );
    var idMsk = charIDToTypeID( "Msk " );
    ref97.putEnumerated( idChnl, idChnl, idMsk );
    desc166.putReference( idAt, ref97 );
    var idUsng = charIDToTypeID( "Usng" );
    var idUsrM = charIDToTypeID( "UsrM" );
    var idRvlA = charIDToTypeID( "RvlA" );
    desc166.putEnumerated( idUsng, idUsrM, idRvlA );
    executeAction( idMk, desc166, DialogModes.ALL );
    and use the method fillPath.
    Edit: Or rather the other way round, a Hide All-Layer Mask:
    var idMk = charIDToTypeID( "Mk  " );
    var desc167 = new ActionDescriptor();
    var idNw = charIDToTypeID( "Nw  " );
    var idChnl = charIDToTypeID( "Chnl" );
    desc167.putClass( idNw, idChnl );
    var idAt = charIDToTypeID( "At  " );
    var ref98 = new ActionReference();
    var idChnl = charIDToTypeID( "Chnl" );
    var idChnl = charIDToTypeID( "Chnl" );
    var idMsk = charIDToTypeID( "Msk " );
    ref98.putEnumerated( idChnl, idChnl, idMsk );
    desc167.putReference( idAt, ref98 );
    var idUsng = charIDToTypeID( "Usng" );
    var idUsrM = charIDToTypeID( "UsrM" );
    var idHdAl = charIDToTypeID( "HdAl" );
    desc167.putEnumerated( idUsng, idUsrM, idHdAl );
    executeAction( idMk, desc167, DialogModes.ALL );

  • How to create a selection or mask from a Selective Color layer

    Hi. I was wondering if it is possible to get a selection/mask out of a Selective Color Layer.
    For instance lets say I have a complicated photo and I put a Selective Color layer on.  I then pick Red and start adjusting. I can see the effect and how it changes the red and how it falls off in the photo. Is it at all possible to create a selection or a mask based off of that effect? 
    Thank you

    You can try this.  Once you get your selective color adjustment layer the way you like it, change it's blending mode to difference.  Add a B&W adjustment layer above that then a curves or levels adjustment layer above that.  Use the curves or levels adjustment layer to give the image more contrast by adjusting the top white values.  This will produce  an image that you can then make a selection from from the channel pallet.

  • How to select copy and paste an image that has a layer mask

    Hi,
    when I select, copy and paste the image it still has the content that I removed using the layer mask.
    I want to paste it over another psd whilst maintaing the transparency.
    Any help would be much appreciated.
    PSD is at
    http://sdrv.ms/16DoRft
    The small jpg is because I don't know what you will see in the skydrive psd
    Michael

    Wow that was so easy!
    Thanks!
    I spent at least half and hour trying to figure out why it wouldn't work.
    Michael

  • Am I Missing Something Obvious? Layer Mask Not Confined to Selection.

    Hello, I really hope I am not missing anything obvious.
    I am working on a .psd in Photoshop CC in which I used a selection to precisely remove a portion of a layer in a layer mask. The problem is that it is removing a percentage of the opacity in the non selected area. The brush has 100% Opacity, 100% Flow and is in Normal Mode. The layer has 100% Opacity, 100% Fill, and is in Normal Mode. I have tried restarting Photoshop and starting over from scratch. Here is an image of the issue.
    My only other concern is that on Friday we had a power outage due to lightning and PS CC closed unexpectedly. Could my PS CC be corrupted? My computer has restarted since then. Any suggestions would be wonderful. Thanks!

    The power outage should not have corrupted your Photoshop to cause this to happen. Worst that could have happened is Photoshop was forced to quit and your preferences did not get save for yourt panel layout and prefertence settings.
    Is your brush filled with 100 black, the swatch looks dark but you may be at 90% black.? Your screenshot looks fine though as if the mask is working correctly, can you post a screenshot that better shwos the problem.

Maybe you are looking for

  • Purchase request

    Hello Experts, Am I right to say that Purchase Requisition and Purchase order are part of MM since purchasing organization is part of MM? So, is it right to say that 3rd party sales is a SD + MM process based on the above? Is it that by using item ca

  • Text in delete button in Edit bookmark popup wont show when avast online security plugin is enabled

    I tried this disabling all extensions and enabling them one at a time. the avast is the culprit. Google didn't help me to find this issue. Maybe I would have posted it in avast forum? Thank for help (although this is not a critical issue as long as o

  • Monitoring SAPconnect message with error into RZ20

    Hello, I would like to send an alert by e-mail every time a message aimed at being sent outside SAP (through SAPconnect layer) fails. I have customized using standard help and OSS notes 546493 and 683974. Into RZ20, I have customized the INT node wit

  • Can't download anything from App Store - MacBook

    I've been using Windows 7 exclusively on my MacBook via Boot Camp for several years. I've since deleted the Windows partition. I ran a Software Update and am currently running OS X 10.6.8. I want to upgrade OS X further but can't download Yosemite (o

  • How to Decrease Pixelations on WMV Output with PE3, PE4, or PE7?  Settings?

    Hi everyone, Hope someone has a reason for this. Doing some .MOV conversion to WMV. I have found some variations depending on computer and platform. I'm not satisfied with the results using Flip4Mac, PE3 or PE7 (see below). I have found the best resu