Skip to content

Instantly share code, notes, and snippets.

@MarshySwamp
Created January 10, 2022 03:33

Revisions

  1. MarshySwamp created this gist Jan 10, 2022.
    19 changes: 19 additions & 0 deletions Elliptical Select All.jsx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    ellipticalSelectAll(0, 0, app.activeDocument.height.value, app.activeDocument.width.value, true);

    function ellipticalSelectAll(top, left, bottom, right, antiAlias) {
    var s2t = function (s) {
    return app.stringIDToTypeID(s);
    };
    var descriptor = new ActionDescriptor();
    var descriptor2 = new ActionDescriptor();
    var reference = new ActionReference();
    reference.putProperty( s2t( "channel" ), s2t( "selection" ));
    descriptor.putReference( s2t( "null" ), reference );
    descriptor2.putUnitDouble( s2t( "top" ), s2t( "pixelsUnit" ), top );
    descriptor2.putUnitDouble( s2t( "left" ), s2t( "pixelsUnit" ), left );
    descriptor2.putUnitDouble( s2t( "bottom" ), s2t( "pixelsUnit" ), bottom );
    descriptor2.putUnitDouble( s2t( "right" ), s2t( "pixelsUnit" ), right );
    descriptor.putObject( s2t( "to" ), s2t( "ellipse" ), descriptor2 );
    descriptor.putBoolean( s2t( "antiAlias" ), antiAlias );
    executeAction( s2t( "set" ), descriptor, DialogModes.NO );
    }