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
Sergey Kritskiy, thanks for the answer.
This code work:
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 withDispatchWhileModal
andtoolModalState
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.