从 Photoshop jsx 脚本开始 "Free Transform"

Starting "Free Transform" from a Photoshop jsx script

黄色,我如何从 jsx 脚本在 Photoshop 中 运行 "Free Transform"。我使用了从 Script Listener 接收到的代码,但是这段代码给出了一个错误:

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 );

此代码:

// =======================================================
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 );

上面的代码不会触发 Transform 操作:您通常可以在 ScriptListener 日志文件中看到一些关于所用操作的提示 — 在 transform 的情况下,它是描述符的名称:Trnf — 这里我们看到调用模态状态和使用套索工具了吗?或类似的东西。实际上所有带有 DispatchWhileModaltoolModalState 的代码在 PS 中没有 运行 并且可以忽略(它可能用于调试)。

我认为,如果您不是很熟悉,从 Scriptlistener 获取代码块的最简单方法是删除日志文件,使用特定值执行您需要的操作,然后在新创建的日志文件。

谢尔盖·克里茨基,感谢您的回答。

此代码有效:

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);

};