skip to Main Content

Hellow, how can i run “Free Transform” in Photoshop from jsx script. I used the received code from ScriptListener, but this code gives an error:

Error 8800: General Photoshop error occurred. This functionality may
not be available in this version of Photoshop. – The command
“” is not currently available. Line: 73 ->
executeAction(idinvokeCommand, desc3666, DialogModes.NO );

This code:

// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc3666 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc3666.putInteger( idcommandID, 2207 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc3666.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc3666, DialogModes.NO );

// =======================================================
var idtoolModalStateChanged = stringIDToTypeID( "toolModalStateChanged" );
    var desc3667 = new ActionDescriptor();
    var idLvl = charIDToTypeID( "Lvl " );
    desc3667.putInteger( idLvl, 1 );
    var idStte = charIDToTypeID( "Stte" );
    var idStte = charIDToTypeID( "Stte" );
    var identer = stringIDToTypeID( "enter" );
    desc3667.putEnumerated( idStte, idStte, identer );
    var idTool = charIDToTypeID( "Tool" );
        var desc3668 = new ActionDescriptor();
        var idIdnt = charIDToTypeID( "Idnt" );
        desc3668.putString( idIdnt, """laso""" );
        var idTtl = charIDToTypeID( "Ttl " );
        desc3668.putString( idTtl, """Lasso Tool""" );
    var idTool = charIDToTypeID( "Tool" );
    desc3667.putObject( idTool, idTool, desc3668 );
    var idKnd = charIDToTypeID( "Knd " );
    var idKnd = charIDToTypeID( "Knd " );
    var idTool = charIDToTypeID( "Tool" );
    desc3667.putEnumerated( idKnd, idKnd, idTool );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc3667.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idtoolModalStateChanged, desc3667, DialogModes.NO );

2

Answers


  1. Chosen as BEST ANSWER

    Sergey Kritskiy, thanks for the answer.

    This code work:

    cTID = function(s) { return app.charIDToTypeID(s); };
    
    sTID = function(s) { return app.stringIDToTypeID(s); };
    
    function InteractiveTransform() {
    
    
        var desc1 = new ActionDescriptor();
    
        var ref1 = new ActionReference();
    
        ref1.putEnumerated(cTID('Mn  '), cTID('MnIt'), cTID('FrTr'));
    
        desc1.putReference(cTID('null'), ref1);
    
        executeAction(cTID('slct'), desc1, DialogModes.NO);
    
    };


  2. The code above doesn’t fire Transform action: you can usually see in the ScriptListener log file some hints about the action used — in a case of transform it’s the name of descriptor: Trnf — here we see invoking of modal state and using a lasso tool? or something like that. And actually all the code with DispatchWhileModal and toolModalState doesn’t run in PS and can be ignored (it’s probably for debugging).

    I think that the easiest way to get a chunk of code from Scriptlistener if you’re not very familiar with it is to delete the log file, do the actions you need with specific values, then search for these values in the newly created log file.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search