Photoshop VB Scripting to apply Layer Mask Reveal Selection to Layer
I'm probably searching on the wrong terminology but I've been looking all day.
I have created a script, it opens a file, I can resize the image, I can have the user select region with magic wand and lasso tools, I can invert the selection, I can create a new layer duplicating the background, and I can save/or/export is all sorts of formats and options. All is good.
Now all I want to do is take the selection (the one I just inverted using oPSDoc.Selection.Invert [where oPSDoc is my OLE Object pointing to my oPSApp.ActiveDocument]) and apply it to my new layer as a mask. The toolbar equivalent to Layer->Layer Mask->Reveal Selection.
Now, I know I can "cheat" and use the "Script Listener" to snoop on the commands and just paste that into my code. But SERIOUSLY! Now I've got a bunch of charIDToTypeID and executeAction which is meaningless to a human or anyone who has to look at my code months from now.
This should be as simple as one line of code (not 14-20 lines of script listener gibberish):
oPSDoc.Selection.LayerMask(oPSMaskLayer, oMaskProperties)
or maybe:
oPSMaskLayer.LayerMask(oPSDoc.Selection, oMaskProperties)
where:
oPSApp = OLE Object ("Photoshop.Application")
oPSDoc = oPSApp.ActiveDocument
oPSMaskLayer = oPSDoc.ActiveLayer.Duplicate
oMaskProperties = some mask object to contain properties and methods for setting things like "Reveal Selection", "Hide Selection", etc...
Thank-you to the first wizard to enlighten me!
