Skip to main content
wckdtall
Inspiring
September 23, 2025
Answered

Action Record Script Items with unique Names

  • September 23, 2025
  • 2 replies
  • 140 views

I'm trying to record menu items via scripting, and am coming up empty. Modifying the below, I've gotten it to show up in the Automate Menu as "Bologna", and record as "Bologna" in actions rather than "Scripts Name: "Bologna"" 
1. How do I create an event ID for my script? I modified this one from Contact Sheet II
2. How do I call my menu item properly with a script? I've tried iterations of: app.runMenuItem(stringIDToTypeID("Bologna"));
And get the error message:
"The object “<unknown> menu item” is not currently available."

3. Alternatively, can I use runMenuItem for any of the scripts? I tride "Automate: Bologna" and "Scripts: Bologna" and neither worked.

GOAL: Is to record a menu item to an action, I'm on an M1 chip and scripting listener no longer works.

Also tried it with contactSheetII and get the same error.

 



/*
<javascriptresource>
  <name>$$$/AdobePlugin/PIPLInfo/PluginName/testing123=Bologna</name>
<menu>automate</menu>
<category>ScriptTesting</category>
<eventid>0B71D221-F8CE-11d2-B21B-0008C75B322D</eventid>
<terminology><![CDATA[<< /Version 1
    /Events <<
       /0B71D221-F8CE-11d2-B21B-0008C75B322D [($$$/AdobePlugin/PIPLInfo/PluginName/testing123=Bologna) /testing123Settings <<
           /CSIISettings [(Bologna Settings) /typeText]
           /Msge [(Message) /typeText]
         >>]
     >>
   >>
]]></terminology>
</javascriptresource>
*/

 

Correct answer Stephen Marsh

@wckdtall 

 

You can read more about using UUID's for event id's here (page 191):

https://raw.githubusercontent.com/Adobe-CEP/CEP-Resources/master/Documentation/Product%20specific%20Documentation/Photoshop%20Scripting/photoshop-cc-javascript-ref-2019.pdf

 

You can use online tools to create a UUID, or even create a script to do so in Photoshop:

 

https://uuid.now/

 

As far as I know, you can't call a custom menu item by name from within a script. To run a script you can do the following:

 

https://gist.github.com/MarshySwamp/eb36460ae2813b6fc47e2d3fec48deb3

 

This is of course different to calling a script from an action.

 

Hope this helps!

2 replies

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
September 28, 2025

@wckdtall 

 

You can read more about using UUID's for event id's here (page 191):

https://raw.githubusercontent.com/Adobe-CEP/CEP-Resources/master/Documentation/Product%20specific%20Documentation/Photoshop%20Scripting/photoshop-cc-javascript-ref-2019.pdf

 

You can use online tools to create a UUID, or even create a script to do so in Photoshop:

 

https://uuid.now/

 

As far as I know, you can't call a custom menu item by name from within a script. To run a script you can do the following:

 

https://gist.github.com/MarshySwamp/eb36460ae2813b6fc47e2d3fec48deb3

 

This is of course different to calling a script from an action.

 

Hope this helps!

wckdtall
wckdtallAuthor
Inspiring
September 29, 2025

Thanks! I need to use actions for distro for other users, this is bridging the gap from me learning UXP, and creating extensions. I ended up being able to create new actions, run and record the scripts, and then just organiz them into an ATN file I can distro. Thanks again for the help!

wckdtall
wckdtallAuthor
Inspiring
September 28, 2025

Used a non M1 mac for script listener, and ended up creating a loop with this revised header with placeholders:

var jsxHeader = "/*\
<javascriptresource>\
  <name>$$$/AdobePlugin/PIPLInfo/PluginName/!!!FUNCTIONTITLE!!!=!!!MENUACTIONTITLE!!!</name>\
<menu>automate</menu>\
<category>!!!CAT!!!</category>\
<eventid>!!!STRINGTYPEID!!!</eventid>\
<terminology><![CDATA[<< /Version 1\
    /Events <<\
       /!!!STRINGTYPEID!!! [($$$/AdobePlugin/PIPLInfo/PluginName/!!!FUNCTIONTITLE!!!=!!!MENUACTIONTITLE!!!) /!!!FUNCTIONTITLE!!!Settings <<\
         >>]\
     >>\
   >>\
]]></terminology>\
</javascriptresource>\
*/";


Brief explanation of what needs to be replaced: 
!!!FUNCTIONTITLE!!! - A unique function/plugin title for the header
!!!MENUACTIONTITLE!!! - Human Readable Description for menus and actions
!!!CAT!!! - Category to separate your scripts in the menu - NOTE: I hardcoded automate.
!!!STRINGTYPEID!!! - A unique string that will be used to call the item via scripting.

The error message is resolved by using executeAction:

executeAction(stringIDToTypeID(!!!INSERT_STRINGTYPEID_HERE!!!))
//Run Menu Item triggers an error
//app.runMenuItem(stringIDToTypeID(STRINGTYPEID_THROWS_ERROR))

 
I still am unable to stop recording actions so it all records as one, but I had 25 save scripts and others I need to distribute, so this is more precise.

Only other downside esthetically, is executeAction records with a "Scripts" Sub menu, vs if you manually choose "Insert Menu Item" which isn't recording appropriately(throws error) via scripting.