Adjustment layer with options

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

undavide

Adjustment layer with options

Post by undavide »

Hello,
I've a little simple script that creates and modifies adj. layers. Is there a way to make it open the options window that usually pops up when pressing the ALT key while creating the layer?



Thanks,
Davide (who has been far from scripting for a while...)

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Adjustment layer with options

Post by Mike Hale »

You can get the 'New Layer' dialog by using scriptlistener code with the dialogmodes set to all. However doing so will also bring up another dialog where the user can set the adjustment( the way adjustment layers worked in CS3 ).

Code: Select allfunction ftn() {
   var desc1 = new ActionDescriptor();
   var ref1 = new ActionReference();
   ref1.putClass(charIDToTypeID('AdjL'));
   desc1.putReference(charIDToTypeID('null'), ref1);
   var desc2 = new ActionDescriptor();
   var desc3 = new ActionDescriptor();
   desc3.putEnumerated(stringIDToTypeID("presetKind"), stringIDToTypeID("presetKindType"), stringIDToTypeID("presetKindDefault"));
   desc2.putObject(charIDToTypeID('Type'), charIDToTypeID('Lvls'), desc3);
   desc1.putObject(charIDToTypeID('Usng'), charIDToTypeID('AdjL'), desc2);
   executeAction(charIDToTypeID('Mk  '), desc1, DialogModes.ALL);
};

I don't see a way to get the first dialog with also getting the second.
MIRYAMM

Adjustment layer with options

Post by MIRYAMM »

Hello is it possible that target the leg.
but I tried the code Mike and I don't work in CS5.
Do not know if this code is what you want

Forgive the intrusion

Code: Select all// =======================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc98 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref56 = new ActionReference();
        var idAdjL = charIDToTypeID( "AdjL" );
        ref56.putClass( idAdjL );
    desc98.putReference( idnull, ref56 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc99 = new ActionDescriptor();
        var idType = charIDToTypeID( "Type" );
            var desc100 = new ActionDescriptor();
            var idpresetKind = stringIDToTypeID( "presetKind" );
            var idpresetKindType = stringIDToTypeID( "presetKindType" );
            var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );
            desc100.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
        var idCrvs = charIDToTypeID( "Crvs" );
        desc99.putObject( idType, idCrvs, desc100 );
    var idAdjL = charIDToTypeID( "AdjL" );
    desc98.putObject( idUsng, idAdjL, desc99 );
executeAction( idMk, desc98, DialogModes.ALL );