Copy link to clipboard
Copied
Hello together,
since CS6+ there is possible to
executeMenuCommand (menuCommandString: string)
Executes a menu command using the menu shortcut string.
Question 1:
Who knows a way to read all the available commands?
Question 2:
At the time I need 'Clear Guides'
app.executeMenuCommand ('Clear Guides')
app.executeMenuCommand ('Clear guides')
app.executeMenuCommand ('clear Guides')
app.executeMenuCommand ('ClearGuides')
app.executeMenuCommand ('clear guides')
and other variants doesn't work.
Who know the right syntax? (Or is this menu command not available????)
Any help is appreciated. (Additional: I know the way to use app.doScript (myAction) - but this is not part of my questions)
try
app.executeMenuCommand ('clearguide')
and let us know if it works, I don't have CS6 to try
Hi guys,
I am posting almost complete list of menu commands.
Already removed plugin-like commands which does not work at all. Some of the entries are still to be confirmed.
There are some entries like for eg. AdobeLayerPalette:
- AdobeLayerPalette1 - show on/off layers window
- AdobeLayerPalette2 - create new layer with no dialog popup
- AdobeLayerPalette3 - create new layer with dialog popup
or
- AdobeNavigator1 - does not work
- AdobeNavigator2 - does not work as well
- AdobeNavigator - show on/off n
...Copy link to clipboard
Copied
Adding to this helpful post a couple of things I've found:
Selection Hat 3 is Select > Object > All on Same Layers
Planet X is Live Paint, Ten_A knew this already in his reference table.
Most of these can be obtained from checking out the .kys saved shortcut keys file and in those non-obvious cases, assigning a key to the menu item, saving the keyboard shortcuts and finding the key char code to narrow down the list of possible items.
Copy link to clipboard
Copied
Adding:
app.executeMenuCommand('selectall');
app.executeMenuCommand('deselectall');
app.executeMenuCommand('selectallinartboard');
And furthermore:
CarlosCanto schrieb:
these are my findings
Selection Hat 1 // Select Direction Handles Selection Hat 10 // save selection...(dialog) Selection Hat 11 // edit selection...(dialog) Selection Hat 12 // SelectObjects Not Aligned to Pixel Grid Selection Hat 2 // Object Arrange Send to current layer Selection Hat 3 // select all on same layer Selection Hat 4 // hide all artwork Above Selection Hat 5 // lock all artwork Above (and touching selected art) this is great it does Hit Test to know what's above and touching Selection Hat 6 // hide other layers Selection Hat 7 // lock other layers Selection Hat 8 // Select->Next Object Above (stacking order) Selection Hat 9 // Select->Next Object Below (stacking order)
Copy link to clipboard
Copied
Here is a updated list for ver.22.
Copy link to clipboard
Copied
What is the "Create Eve Dialog"?
Copy link to clipboard
Copied
Thank you for your notify.
Its used in debug environment and I removed it from list.
Copy link to clipboard
Copied
So it did not do anything?
Copy link to clipboard
Copied
Yes, It's used in native SDK. we can't use it in ExtendScript.
Copy link to clipboard
Copied
thanks Ten, is there anything new and exiting?
Copy link to clipboard
Copied
I included a few things that were not listed in the previous list like Photoshop plugins and some panels under the windows menu.
And removed around legacy text conversions because of their not work correctly.
Copy link to clipboard
Copied
For those in need, ive found a list of v25
https://ten-artai.com/illustrator-ccver-22-menu-commands-list/
Copy link to clipboard
Copied
You don't know a way to set the amount that it needs to offset do you? Rather than the UI to enter the amount?
-Boyd
Copy link to clipboard
Copied
the executeMenuCommand is like you have just clicked the menu item.
so you cannot bypass the UI using this method.
can be done via an action.
action can be created , Run and destroyed via javascript
this example will work. just be careful as it does not have any safeguards.
ie, var f = new File('~/ScriptAction.aia'); will overwrite any file of that name in that location. then the script removes the file deleting it from your system.
if you had a file of that name in that location then ... bad luck...
and does not check if action of that name exists etc...
function offset_item_via_action(){
// Set your offset distance here
var Offset = "25.0";
//
if(app.documents.length = 0){return;}
var ActionString = [
'/version 3',
'/name [ 16',
'53637269707465645f416374696f6e73',
']',
'/isOpen 1',
'/actionCount 1',
'/action-1 {',
'/name [ 13',
'4f66667365745f416374696f6e',
']',
' /keyIndex 0',
'/colorIndex 0',
' /isOpen 1',
'/eventCount 1',
' /event-1 {',
'/useRulersIn1stQuadrant 0',
' /internalName (ai_plugin_offset)',
'/localizedName [ 11',
'4f66667365742050617468',
']',
' /isOpen 1',
'/isOn 1',
' /hasDialog 1',
'/showDialog 0',
' /parameterCount 3',
'/parameter-1 {',
'/key 1868985204',
' /showInPalette -1',
'/type (unit real)',
' /value ' + Offset + '',
'/unit 592476268',
'}',
' /parameter-2 {',
'/key 1835627634',
' /showInPalette -1',
'/type (real)',
' /value 4.0',
'}',
' /parameter-3 {',
'/key 1785623664',
' /showInPalette -1',
'/type (enumerated)',
' /name [ 5',
'4d69746572',
']',
'/value 2',
'}',
'}',
'}'
].join('\n');
createAction(ActionString);
var ActionString = null;
app.doScript("Offset_Action", "Scripted_Actions", false);
app.unloadAction("Scripted_Actions","");
function createAction (str) {
var f = new File('~/ScriptAction.aia');
f.open('w');
f.write(str);
f.close();
app.loadAction(f);
f.remove();
}
}
offset_item_via_action();
Copy link to clipboard
Copied
So handy having these codes! Could i ask how you get all of these?
Im also looking for a scsriptlistener for Illustrator, if that exists
Copy link to clipboard
Copied
Is it possible to pass parameters to a Effect? say, an Effect->Distort->Roughen?
I would like to randomize parameters for, e.g., each path.
Copy link to clipboard
Copied
no, not possible but you can use applyEffect()
check these threads for more info
Re: PageItem.applyEffect(LiveEffectXML)
Re: Applying Live effects (offset path) in Illustrator using AS
Copy link to clipboard
Copied
Carlos speeds past me to the finish line!
I was gonna say: read this:
Copy link to clipboard
Copied
Only as a small addition.
How to get the name for a specific menu command (if not already listed):
Thank you so much!!
I'm still baffled at how badly Adobe has documented their stuff (and the lack of tutorials they provide)!
Any idea where I could find the latest menu commands list (for Illustrator CC 2020)?
From your links and this post (https://community.adobe.com/t5/illustrator/get-menu-command-strings/m-p/8539169?page=1#M216220), I found a way to get the menu command:
(Explained here for future lost programmers 😉 )
1) Create a new Action set
2) Then choose "Insert Menu Item"
3) Search for the right menu item and add it to the action set.
4) Click "Save Actions" from the small menu in the Action panel
5) Open the saved .aia file in some text editor
6) Find the 'event', in my case it was under "/event-2 {"
7) In my case '/parameter-1' had a '/value' of "4c6976652041646f62652050534c20476175737369616e20426c7572"
8) Convert that value from HEX to ASCII (I used: https://www.rapidtables.com/convert/number/hex-to-ascii.html) and get the menu command. In this case "Live Adobe PSL Gaussian Blur". (Which worked when used in Illustrator CC 2020.)
I still get the popup dialog with the options to adjust. So if anyone knows how to set these and skip the dialog, that would be awesome !
By @philipv71883047