Copy link to clipboard
Copied
Is there a way to edit a "right-click menu"? For instance, working with tables, if I highlight a row and want to copy it, I'd love to be able to right click and select "Copy". Can it be done?
{Renamed by MOD}
Copy link to clipboard
Copied
Hi,
don't think so.
Why do you need a context menu entry for this?
If you selected a table row the menu command for Copy is available.
Shortcut:
Ctrl + c or Cmd + c
Regards,
Uwe
Copy link to clipboard
Copied
Hi there,
Thanks for reaching out. As Uwe mentioned, InDesign doesn't have a feature to edit right-click menus, however, you can raise this idea here: Adobe InDesign Feedback.
This is the best way of communicating with the Engineering and Product Management teams regarding issues and suggestions so they can be implemented in future releases.
Regards,
Srishti
Copy link to clipboard
Copied
srishtib8795206 wrote
As Uwe mentioned, InDesign doesn't have a feature to edit right-click menus, however, you can raise this idea here: Adobe InDesign Feedback.
So this no longer works? (Table menus appear courtesy of Marc Autret's example at Indiscripts :: How to Create your Own InDesign Menus ). Since which version of InDesign? If it does not, then this should be reported not as a "Feature Request" but rather at Adobe InDesign: Bugs. (And it should be repaired/reinstated asap.)
Copy link to clipboard
Copied
Hi Jongware,
adding menu items to context menu by scripting is still working.
Here a sample from my German InDesign CC 2019 where I included Copy ("Kopieren") and Paste ("Einfügen"):
I changed Dirk Becker's script to do this.
FWIW: The German name "Einfügen" is a bit ambiguous. It could mean "Insert" ( like the submenu "Einfügen > " is showing ) and "Paste" like "Einfügen" with the keyboard shortcut "Strg+C" that automatically came over with the associated menu action.
Regards,
Uwe
Copy link to clipboard
Copied
You all are fabulous and very responsive. Unfortunately this 62-year-old doesn't feel comfortable working with scripts, but maybe I can find someone at the office who can help me with it if they aren't too busy. I'm sure other people will be able to benefit from all your knowledge and expertise.
Copy link to clipboard
Copied
Thanks, Uwe – happy to have misunderstood the redirection to Feature Requests. It could be useful to have an easy "customize menus" dialog, but through scripting so much more is possible.
Can you post your entire script with these modifications?
Copy link to clipboard
Copied
Hi Jongware,
yes. The code is below.
One warning in advance:
It's not easy to remove the two menu items once you added them to the context menu.
A simple restart of InDesign will not remove them! You have to trash your InDesign cache files as well.
Another warning:
It could be that you do not see the Paste menu item in the context menu before you used the Copy menu item in the context menu at least once.
ExtendScript ( JavaScript ) code.
Handle with care:
/**
* @@@BUILDINFO@@@ Add-MenuItem-Copy-Paste-to-ContextMenu-RtMouseTable.jsx !Version! Thu Jun 13 2019 18:42:56 GMT+0200
*/
/*
Tested and working with InDesign CC 2019 on Windows 10.
See discussion at Adobe InDesign Forum:
Edit right-click Menu in InDesign
PJ in NH Jun 12, 2019 11:43 PM
https://community.adobe.com/t5/indesign-discussions/edit-right-click-menu-in-indesign/td-p/10527781
Is there a way to edit a "right-click menu"?
For instance, working with tables, if I highlight a row and want to copy it,
I'd love to be able to right click and select "Copy".
Can it be done?
Adapted code by Uwe Laubender.
Original code by Dirk Becker
for adding a "No Break" to the context menu when text is selected.
See Dirk's code here:
Dirk Becker, Feb 23, 2021
https://community.adobe.com/t5/indesign-discussions/edit-right-click-menu-in-indesign/m-p/11851064#M415541
*/
( function () {
var miCopy =
app.menus.itemByName("$ID/Main").menuElements.itemByName("$ID/Edit").menuElements.
itemByName("$ID/Copy").getElements()[0]; // menuItem
var miPaste =
app.menus.itemByName("$ID/Main").menuElements.itemByName("$ID/Edit").menuElements.
itemByName("$ID/Paste").getElements()[0]; // menuItem
var atc = app.menus.itemByName( "$ID/RtMouseTable" );
try
{
atc.menuItems.itemByName(miCopy.name).remove();
atc.menuItems.itemByName(miPaste.name).remove();
}catch( ex ) {};
atc.menuItems.add
(
miCopy.associatedMenuAction ,
LocationOptions.BEFORE ,
atc.submenus.itemByName("$ID/Insert")
);
atc.menuItems.add
(
miPaste.associatedMenuAction ,
LocationOptions.BEFORE ,
atc.submenus.itemByName("$ID/Insert")
);
})();
Regards,
Uwe
//EDITED for better readability and links removed that do not longer work.
Copy link to clipboard
Copied
Here a scripting code sample from Dirk Becker where the command "Apply No Break" is added to a context menu:
Note:
This context menu is not the one you are after when working with selected table rows.
Dirk is using "$ID/RtMouseText" that is the context menu for selected text.
Regards,
Uwe
// EDITED link
Copy link to clipboard
Copied
FWIW:
The right name for the context menu you see when you select a table row if you like to script it is:
"$ID/RtMouseTable"
If you want the Copy command there I suggest you also add the Paste command.
Regards,
Uwe
Copy link to clipboard
Copied
Here is the unchanged 2009 code sample.
#target "InDesign"
/* This script will copy the existing menu action into a new menu item.
The "$ID/" strings ensure it will even work with localized versions of InDesign.
For permanent execution, save the script as startup script e.g. in a folder "path to InDesign/Scripts/new folder/startup scripts".
Dirk
*/
( function () {
var anb = app.menus.itemByName("$ID/CharPanelPopup").menuItems.itemByName("$ID/Apply no break");
var atc = app.menus.itemByName("$ID/RtMouseText");
try {
atc.menuItems.itemByName(anb.name).remove();
} catch( ex ) {};
atc.menuItems.add(anb.associatedMenuAction,LocationOptions.BEFORE,atc.menuItems .itemByName("$ID/ClearAllOverrides"));
})();