Skip to main content
Adobe Photoshop Family

954 Messages

 • 

15.3K Points

Wed, Mar 30, 2016 8:40 PM

Solved

Photoshop: Javascript - can't unlock folder with script which was generated by ScriptListener

PS - script - can't unlock folder with script which was generated by Script Listener

#target photoshop
app.bringToFront();

var idapplyLocking = stringIDToTypeID( "applyLocking" );
var desc10 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref5 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref5.putEnumerated( idLyr, idOrdn, idTrgt );
desc10.putReference( idnull, ref5 );
var idlayerLocking = stringIDToTypeID( "layerLocking" );
var desc11 = new ActionDescriptor();
var idprotectNone = stringIDToTypeID( "protectNone" );
desc11.putBoolean( idprotectNone, true );
var idlayerLocking = stringIDToTypeID( "layerLocking" );
desc10.putObject( idlayerLocking, idlayerLocking, desc11 );
executeAction( idapplyLocking, desc10, DialogModes.NO );
I am trying unlock this folder with script above but it doesn't work. If click on lock icon(locks toolbar and lock icon next to layer name), then script listener generate this code. I can see new item in history panel.

I am trying run it from Extend ScriptToolkit. It works good for every layers inside folder and layers in subfolders, but not for folders itself.

Responses

Official Solution

Adobe Administrator

 • 

15.4K Messages

 • 

291.1K Points

3 years ago

This issue should be fixed by the Photoshop CC 2018 (19.1) update that was released today.

Sr. Product Manager, Adobe Digital Imaging

34 Messages

 • 

1.1K Points

5 years ago

The bad news is Photoshop CC 2015 seems to be recording the wrong thing. You can see this by using the actions panel and the recorded "with none" does NOT play back correctly. It is saying "Apply locking current layer" what?

The good news is I tried Photoshop CS6 and it says "set" as the command. The CS6 code below does play back correctly in CS6 and CC 2015.

I'll file a bug.

// =======================================================var idsetd = charIDToTypeID( "setd" );
    var desc50 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref28 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref28.putEnumerated( idLyr, idOrdn, idTrgt );
    desc50.putReference( idnull, ref28 );
    var idT = charIDToTypeID( "T   " );
        var desc51 = new ActionDescriptor();
        var idlayerLocking = stringIDToTypeID( "layerLocking" );
            var desc52 = new ActionDescriptor();
            var idprotectNone = stringIDToTypeID( "protectNone" );
            desc52.putBoolean( idprotectNone, true );
        var idlayerLocking = stringIDToTypeID( "layerLocking" );
        desc51.putObject( idlayerLocking, idlayerLocking, desc52 );
    var idLyr = charIDToTypeID( "Lyr " );
    desc50.putObject( idT, idLyr, desc51 );
executeAction( idsetd, desc50, DialogModes.NO );

954 Messages

 • 

15.3K Points

5 years ago

Script works perfect! So I probably now have the fastest and best script for unlock everthing in layers panel :-) Some other script is working 30 sec to unlock 960 layers. My script can do it in less than 1 sec.