• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Subtract Selection

Engaged ,
May 27, 2019 May 27, 2019

Copy link to clipboard

Copied

Hello everyone,

I have this layer, and I want to script a subtraction of a rectangle that is the lower 40% of the canvas height from my selection.

this way:

END RESULT :

any tips?

TOPICS
Actions and scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , May 27, 2019 May 27, 2019

function selMake(t,l,b,r,E,M) { //Top, Left, Bottom, Right, true = Elipse false=Rectangular?, Mode(0=select, 1=add, 2 = subs, 3 = inter)

    try{

    var desc1324 = new ActionDescriptor();

        var ref496 = new ActionReference();

        ref496.putProperty( cTID('Chnl'), cTID('fsel') );

    desc1324.putReference( cTID('null'), ref496 );

        var desc1325 = new ActionDescriptor();

        desc1325.putUnitDouble( cTID('Top '), cTID('#Pxl'), parseFloat(t) );

        desc1325.putUnitDouble( cTID('Left

...

Votes

Translate

Translate
Adobe
Explorer ,
May 27, 2019 May 27, 2019

Copy link to clipboard

Copied

function selMake(t,l,b,r,E,M) { //Top, Left, Bottom, Right, true = Elipse false=Rectangular?, Mode(0=select, 1=add, 2 = subs, 3 = inter)

    try{

    var desc1324 = new ActionDescriptor();

        var ref496 = new ActionReference();

        ref496.putProperty( cTID('Chnl'), cTID('fsel') );

    desc1324.putReference( cTID('null'), ref496 );

        var desc1325 = new ActionDescriptor();

        desc1325.putUnitDouble( cTID('Top '), cTID('#Pxl'), parseFloat(t) );

        desc1325.putUnitDouble( cTID('Left'), cTID('#Pxl'), parseFloat(l) );

        desc1325.putUnitDouble( cTID('Btom'), cTID('#Pxl'), parseFloat(b) );

        desc1325.putUnitDouble( cTID('Rght'), cTID('#Pxl'), parseFloat(r) );

      

    if (E) desc1324.putObject( cTID('T  '), cTID('Elps'), desc1325 );

    else desc1324.putObject( cTID('T  '), cTID('Rctn'), desc1325 );

  

    desc1324.putBoolean( cTID('AntA'), true );

  

    switch(M){

        case 0:{

            executeAction( cTID('setd'), desc1324, DialogModes.NO );

            break;

            }

        case 1:{

            executeAction( cTID('AddT'), desc1324, DialogModes.NO );

            break;

            }

        case 2:{

            executeAction( cTID('SbtF'), desc1324, DialogModes.NO );

            break;

            }

        case 3:{

            executeAction( cTID('IntW'), desc1324, DialogModes.NO );

            break;

            }

        default:

        break;

          

        }  

    }catch(er){}

};

function cTID(s) { return app.charIDToTypeID(s); };

function sTID(s) { return app.stringIDToTypeID(s); };

function cTT(v) {return charIDToTypeID(v)};

function sTT(v) {return stringIDToTypeID(v)}

var h = app.activeDocument.height

var w = app.activeDocument.width

selMake((h*0.6),0,h,w,false,2)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 27, 2019 May 27, 2019

Copy link to clipboard

Copied

LATEST

Thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines