Skip to content

Instantly share code, notes, and snippets.

@cg-method
Last active July 25, 2019 14:17
Show Gist options
  • Save cg-method/f6a2c1240792f134a1516931be3d195e to your computer and use it in GitHub Desktop.
Save cg-method/f6a2c1240792f134a1516931be3d195e to your computer and use it in GitHub Desktop.
【Photoshop】グループマスクをON/OFFするスクリプト
var topLayer = app.activeDocument.layers[0];
app.activeDocument.activeLayer = topLayer;
do {
try{
if(activeDocument.activeLayer.typename == "LayerSet"){
closeClippingMask();
}
}catch(e){}
selectLayerBelow();
} while(topLayer != app.activeDocument.activeLayer);
function closeClippingMask(){
var idsetd = charIDToTypeID( "setd" );
var desc19 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref1.putEnumerated( idLyr, idOrdn, idTrgt );
desc19.putReference( idnull, ref1 );
var idT = charIDToTypeID( "T " );
var desc20 = new ActionDescriptor();
var idUsrM = charIDToTypeID( "UsrM" );
desc20.putBoolean( idUsrM, false );
var idLyr = charIDToTypeID( "Lyr " );
desc19.putObject( idT, idLyr, desc20 );
executeAction( idsetd, desc19, DialogModes.NO );
}
function selectLayerBelow() {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Bckw" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putBoolean( charIDToTypeID( "MkVs" ), false );
executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment