Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Re: script with Magic Wand tool ?

$
0
0

To have better control over what is selected you need to add other arguments to the scriptlistener function.

 

function magicWand(x,y,tolerance,anit_alias,contiguous,sampleAll) {    if(arguments.length < 2) return;// make sure have x,y - other arguments are optional    if(undefined == tolerance) var tolerance = 32;// set defaults of optional arguments    if(undefined == anit_alias) var anit_alias = true;    if(undefined == contiguous) var contiguous = false;     if(undefined == sampleAll) var sampleAll = false;    var desc = new ActionDescriptor();        var ref = new ActionReference();        ref.putProperty( charIDToTypeID('Chnl'), charIDToTypeID('fsel') );    desc.putReference( charIDToTypeID('null'), ref );        var positionDesc = new ActionDescriptor();        positionDesc.putUnitDouble( charIDToTypeID('Hrzn'), charIDToTypeID('#Rlt'), x );// in pixels        positionDesc.putUnitDouble( charIDToTypeID('Vrtc'), charIDToTypeID('#Rlt'), y );    desc.putObject( charIDToTypeID('T   '), charIDToTypeID('Pnt '), positionDesc );    desc.putInteger( charIDToTypeID('Tlrn'), tolerance);    desc.putBoolean( charIDToTypeID('Mrgd'), sampleAll );    if(!contiguous) desc.putBoolean( charIDToTypeID( 'Cntg' ), false );    desc.putBoolean( charIDToTypeID('AntA'), anit_alias );    executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
};
magicWand(100,100,10,true,true);

Viewing all articles
Browse latest Browse all 27456

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>