从Photoshop jsx脚本启动“免费变换”

时间:2019-03-11 19:05:04

标签: javascript jsx photoshop photoshop-script

Hellow,我该如何从jsx脚本在Photoshop中运行“免费转换”。我使用了从ScriptListener接收的代码,但是此代码给出了错误:

  

错误8800:发生一般的Photoshop错误。此功能可能   在此版本的Photoshop中不可用。 - 命令   “”当前不可用。行: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 );

1 个答案:

答案 0 :(得分:0)

谢尔盖·克里斯基(Sergey Kritskiy),谢谢您的回答。

此代码有效:

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

};