Skip to content

Instantly share code, notes, and snippets.

@MarshySwamp
Created January 3, 2020 15:21
Show Gist options
  • Save MarshySwamp/0b1d078fba846dc9df8203caf2c36398 to your computer and use it in GitHub Desktop.
Save MarshySwamp/0b1d078fba846dc9df8203caf2c36398 to your computer and use it in GitHub Desktop.
Code Snippet: Deselect All Layers (2 Different Methods)
// Deselect All Layers
// forums.adobe.com/message/5204655#5204655 - Michael L Hale
app.runMenuItem(stringIDToTypeID('selectNoLayers'));
// Or...
// Deselect All Layers (AM Code Through Clean SL)
selectNoLayers();
function selectNoLayers() {
var c2t = function (s) {
return app.charIDToTypeID(s);
};
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated( s2t( "layer" ), s2t( "ordinal" ), s2t( "targetEnum" ));
descriptor.putReference( c2t( "null" ), reference );
executeAction( s2t( "selectNoLayers" ), descriptor, DialogModes.NO );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment