Copy link to clipboard
Copied
Something I do often is to change the Blending Options of folders (groups), and I wondered if it would be possible to run a script to do it instead of having to do it manually every time.
What I do after opening the Blending Options on the selected folder is to hold down the Option (Alt) key and drag half of the white slider on the right over to the left (changing it on the right hand side from 255 to 0 / 255).
Is there a way to run a script to do this? Any help would really be appreciated
Here are some screenshots of what I do
blend_if(0,0, 255,255, 0,0, 0,255, "k");
////////////////////////////////////////////////////////////////////////////////////////////
function blend_if(db0,db1, dw0,dw1, sb0,sb1, sw0,sw1, ch)
{
try {
if (db0 == undefined) db0 = 0;
if (db1 == undefined) db1 = db0;
if (dw0 == undefined) dw0 = 255;
if (dw1 == undefined) dw1 = dw0;
if (sb0 == undefined) sb0 = 0;
if (sb1 == undefined) sb1 = sb0;
if (sw0 == undefined) sw0 = 255;
if (sw1 == un
...Copy link to clipboard
Copied
blend_if(0,0, 255,255, 0,0, 0,255, "k");
////////////////////////////////////////////////////////////////////////////////////////////
function blend_if(db0,db1, dw0,dw1, sb0,sb1, sw0,sw1, ch)
{
try {
if (db0 == undefined) db0 = 0;
if (db1 == undefined) db1 = db0;
if (dw0 == undefined) dw0 = 255;
if (dw1 == undefined) dw1 = dw0;
if (sb0 == undefined) sb0 = 0;
if (sb1 == undefined) sb1 = sb0;
if (sw0 == undefined) sw0 = 255;
if (sw1 == undefined) sw1 = sw0;
if (ch == undefined) ch = "krgb";
var use_r = false;
var use_g = false;
var use_b = false;
var use_k = false;
if (ch.indexOf("r") >= 0) use_r = true;
if (ch.indexOf("g") >= 0) use_g = true;
if (ch.indexOf("b") >= 0) use_b = true;
if (ch.indexOf("k") >= 0) use_k = true;
var desc3 = new ActionDescriptor();
var desc4 = new ActionDescriptor();
var ref1 = new ActionReference();
var list1 = new ActionList();
ref1.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc3.putReference( charIDToTypeID( "null" ), ref1 );
for (var i = 0; i < 4; i++)
{
var desc5 = new ActionDescriptor();
var ref2 = new ActionReference();
use_cont = false;
switch ( i )
{
case 0: if (!use_k) { use_cont = true; break; } ref2.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Gry " ) ); break;
case 1: if (!use_r) { use_cont = true; break; } ref2.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Rd " ) ); break;
case 2: if (!use_g) { use_cont = true; break; } ref2.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Grn " ) ); break;
case 3: if (!use_b) { use_cont = true; break; } ref2.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Bl " ) ); break;
}
if (use_cont) continue;
desc5.putReference( charIDToTypeID( "Chnl" ), ref2 );
desc5.putInteger( charIDToTypeID( "SrcB" ), sb0 );
desc5.putInteger( charIDToTypeID( "Srcl" ), sb1 );
desc5.putInteger( charIDToTypeID( "SrcW" ), sw0 );
desc5.putInteger( charIDToTypeID( "Srcm" ), sw1 );
desc5.putInteger( charIDToTypeID( "DstB" ), db0 );
desc5.putInteger( charIDToTypeID( "Dstl" ), db1 );
desc5.putInteger( charIDToTypeID( "DstW" ), dw0 );
desc5.putInteger( charIDToTypeID( "Dstt" ), dw1 );
list1.putObject( charIDToTypeID( "Blnd" ), desc5 );
}
desc4.putList( charIDToTypeID( "Blnd" ), list1 );
desc3.putObject( charIDToTypeID( "T " ), charIDToTypeID( "Lyr " ), desc4 );
executeAction( charIDToTypeID( "setd" ), desc3, DialogModes.NO );
}
catch (e) { alert(e); }
}
Copy link to clipboard
Copied
Perfect, thanks so much!