Created
January 6, 2022 00:58
-
-
Save MarshySwamp/cbd0f135aa6ad089b053c80a2a02edaa to your computer and use it in GitHub Desktop.
Add a "reveal" or "hide" selection based layer mask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maskSelection("revealSelection"); | |
function maskSelection(maskParameter) { | |
// Parameter = "revealSelection" or "hideSelection" | |
var s2t = function (s) { | |
return app.stringIDToTypeID(s); | |
}; | |
var descriptor = new ActionDescriptor(); | |
var reference = new ActionReference(); | |
descriptor.putClass( s2t( "new" ), s2t( "channel" )); | |
reference.putEnumerated( s2t( "channel" ), s2t( "channel" ), s2t( "mask" )); | |
descriptor.putReference( s2t( "at" ), reference ); | |
descriptor.putEnumerated( s2t( "using" ), s2t( "userMaskEnabled" ), s2t( maskParameter )); | |
executeAction( s2t( "make" ), descriptor, DialogModes.NO ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment