Last active
June 26, 2022 21:35
-
-
Save MarshySwamp/df372e342ac87854ffe08e79cbdbcbb5 to your computer and use it in GitHub Desktop.
Align Active Layer to Select All.jsx
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
// Align Active Layer to Select All.jsx | |
// Change as required | |
align2SelectAll('AdCH'); | |
align2SelectAll('AdCV'); | |
function align2SelectAll(method) { | |
//www.ps-scripts.com/viewtopic.php?f=66&t=7036&p=35273&hilit=align+layer#p35273 | |
/* | |
//macscripter.net/viewtopic.php?id=38890 | |
AdLf = Align Left | |
AdRg = Align Right | |
AdCH = Align Centre Horizontal | |
AdTp = Align Top | |
AdBt = Align Bottom | |
AdCV = Align Centre Vertical | |
*/ | |
app.activeDocument.selection.selectAll(); | |
var desc = new ActionDescriptor(); | |
var ref = new ActionReference(); | |
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt")); | |
desc.putReference(charIDToTypeID("null"), ref); | |
desc.putEnumerated(charIDToTypeID("Usng"), charIDToTypeID("ADSt"), charIDToTypeID(method)); | |
try { | |
executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO); | |
} catch (e) {} | |
app.activeDocument.selection.deselect(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment