Skip to main content
caughtnapping
Participant
May 2, 2015
Answered

How do I find the menuID for the Photoshop Transform menu

  • May 2, 2015
  • 2 replies
  • 2420 views

I am new to using ExtendScript and want to create a script that starts by selecting Transform >> Skew. The JavaScript script reference mentions the method 'runMenuItem' but I don't know how to find the menuID to use it.

This topic has been closed for replies.
Correct answer I have gone

You create an action to select it using insert menuitem, then look at the scriptlistner output, from this you can use.

try{

app.runMenuItem(charIDToTypeID('Skew'));

}catch(e){};

2 replies

JJMack
Community Expert
Community Expert
May 2, 2015

cTID = function(s) { return app.charIDToTypeID(s); };

sTID = function(s) { return app.stringIDToTypeID(s); };

//==================== Interactive Transform ==============

function InteractiveTransform() {

  // Menu Edit>Free transform

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

};

Photoshop Javascript guide Appendix A: Event ID Codes has  all the cods like FrTr  for transform

use Scriptlistener Plugin to record Action manager code.  Create functions the uset the functions.

try{

  InteractiveTransform()

  }catch(e){alert("Image Transform Canceled");}

JJMack
I have goneCorrect answer
Inspiring
May 2, 2015

You create an action to select it using insert menuitem, then look at the scriptlistner output, from this you can use.

try{

app.runMenuItem(charIDToTypeID('Skew'));

}catch(e){};

caughtnapping
Participant
May 3, 2015

Thanks for that....now if only I could get ScriptListener to work with Photoshop CC 2014. Not sure it's compatible yet as it doesn't show under Extensions after being placed in the Plugins folder and rebooting. Any suggestions?

JJMack
Community Expert
Community Expert
May 3, 2015

You need to download the correct version of scriptlistener for cc 2014 Adobe Photoshop Scripting | Adobe Developer Connection

On my windows system I have it installed at all times.  Which will make  recording Photoshop tool recording while recordind actions impossible for Adobe disables that Photoshop feature when  the scriptlistener Plug-in is installed.  Which I do not mind for the Photoshop tool recording features was not designed or implemented well.  Actions with tools recordings also only work when the actions are used on documents the same size and resolution that the actions were recorded.

With the Script listener plug-in installed on my Windows system I prevent the log files from becoming large by making them READ only.  When I want the plugin to actually record what I do ins Jacascript.  I will start a little Windows BAT file to control to control and utilize the Javascript log file.  The bat file is in a little Line Command  window in the lower right corner of my display. With it I control the Javascript log file Read only attribute so I can turn on and off the recording. The bat also enables me to extract what I need from the log file and also and can also clear out the log file .

       @Echo Off
:loop
       CLS
rem Display Log File Size
       Dir "%USERPROFILE%\Desktop\ScriptingListenerJS.log" /T:W /4 | find "%ScriptingListenerJS.log"
rem Display Log Attributes  R read only Locked no R log is Unlocked
       Attrib "%USERPROFILE%\Desktop\ScriptingListenerJS.log"
Rem If timeout is use the above display lines will refresh over time else you need to use enter or number
       CHOICE /C 123456 /N /T 300 /D 6 /M "Enter:1 to Lock, 2 to Unlock, 3 to Edit, 4 to Clear, 5 To Exit :"
       Echo %ERRORLEVEL%
        if %ERRORLEVEL%==6 goto timeout
        if %ERRORLEVEL%==1 goto one
        if %ERRORLEVEL%==2 goto two
        if %ERRORLEVEL%==3 goto three
        if %ERRORLEVEL%==4 goto four
        if %ERRORLEVEL%==5 goto five
         goto loop
:timeout
       goto loop
:one
       Attrib +R "%USERPROFILE%\Desktop\ScriptingListenerJS.log"
       goto loop
:two
       Attrib -R "%USERPROFILE%\Desktop\ScriptingListenerJS.log"
       goto loop
:three
       Rem inline command use CMD independent command use start
       CMD /C notepad "%USERPROFILE%\Desktop\ScriptingListenerJS.log"
       rem Start notepad "%USERPROFILE%\Desktop\ScriptingListenerJS.log"
       goto loop
:four
       Rem If the script log file is unlocked not read only  this echo will clear it
       Echo. > "%USERPROFILE%\Desktop\ScriptingListenerJS.log"
      goto loop
:five
      EXIT

JJMack