Created
December 23, 2015 15:27
-
-
Save lm913/00660da81952f7bf9c05 to your computer and use it in GitHub Desktop.
Uses Apply Image on a Mask within a pre-preprocessing script
This file contains hidden or 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
function psApplyImgMask(sourceName,destName){ | |
cTID = function(s) { return app.charIDToTypeID(s); }; | |
sTID = function(s) { return app.stringIDToTypeID(s); }; | |
app.activeDocument.activeLayer = doc.artLayers.getByName(destName); //variable must be string | |
var descAIM1 = new ActionDescriptor(); | |
var refAIM1 = new ActionReference(); | |
refAIM1.putEnumerated(cTID("Chnl"), cTID("Chnl"), cTID("Msk ")); | |
descAIM1.putReference(cTID("null"), refAIM1); | |
descAIM1.putBoolean(cTID("MkVs"), false); | |
executeAction(cTID("slct"), descAIM1, DialogModes.NO); | |
var descAIM2 = new ActionDescriptor(); | |
var descAIM3 = new ActionDescriptor(); | |
var refAIM2 = new ActionReference(); | |
refAIM2.putEnumerated(cTID("Chnl"), cTID("Chnl"), cTID("RGB ")); | |
refAIM2.putName(cTID("Lyr "), sourceName); //variable must be string | |
descAIM3.putReference(cTID("T "), refAIM2); | |
descAIM3.putBoolean(cTID("Invr"), true); | |
descAIM3.putBoolean(cTID("PrsT"), true); | |
descAIM2.putObject(cTID("With"), cTID("Clcl"), descAIM3); | |
executeAction(cTID("AppI"), descAIM2, DialogModes.NO); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment