Hey! I have a super quick question that I have spend way to much time struggling with.
I am rewriting an action into a script file and I am looking for the correct way to add to a selection within a script, same as ctrl+shift clicking in photoshop. As of now I have the script selecting the layer mask, rotating the selection, and expanding the selection by 1%. The one step I am missing is adding the original layer mask selection back to the rotated selection.
The current code I have is
var doc = activeDocument;
var old_units = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
if (app.documents.length > 0) {main()};
function main () {
var theCheck = hasLayerMask();
if (theCheck == true) {
var idchannel = stringIDToTypeID( "channel" );
var idmask = stringIDToTypeID( "mask" );
loadSelectionOfLayerMask();
transformSelctionOfLayerMask();
}
};
function hasLayerMask () {
var m_Dsc01, m_Ref01;
m_Ref01 = new ActionReference();
m_Ref01.putEnumerated(stringIDToTypeID("layer"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
m_Dsc01 = executeActionGet(m_Ref01);
return m_Dsc01.hasKey(charIDToTypeID("Usrs"));
};
function loadSelectionOfLayerMask() {
try {
var idchannel = stringIDToTypeID( "channel" );
var desc70 = new ActionDescriptor();
var ref9 = new ActionReference();
ref9.putProperty( idchannel, stringIDToTypeID( "selection" ) );
desc70.putReference( stringIDToTypeID( "null" ), ref9 );
var ref10 = new ActionReference();
ref10.putEnumerated( idchannel, idchannel, stringIDToTypeID( "mask" ) );
desc70.putReference( stringIDToTypeID( "to" ), ref10 );
executeAction( stringIDToTypeID( "set" ), desc70, DialogModes.NO );
} catch (_error) {alert (_error)}
};
function transformSelctionOfLayerMask()
{
try{
app.activeDocument.selection.rotateBoundary(90,(AnchorPosition.MIDDLECENTER))
app.activeDocument.selection.resizeBoundary(101,101,(AnchorPosition.MIDDLECENTER))
}
catch (_error) {alert (_error)}
};
Thanks!