app.execMenuItem() -- Needing to whitelist this function ?
- October 2, 2021
- 3 replies
- 4823 views
I wish to execute Menu Items as button actions, created apart from the GUI 'Select Action' options.
If I understand correctly, privilege rules require that 'Execute a Menu Item' actions need be whitelisted, in a folder that regulates Trust, so that I can execute the action, when I 'Run a JavaScript' containing said execution, as an Action from a button on a document page. And I understand that Trust 'exceptions' are on a per-machine basis.
I have read the advice written by Thom, Gilad, Karl, JR, and others. I've now found the locations of both User, and Global, folder repositories, but can't figure out:
- What name is to be given to the relevant White List Folder ?
- How do I list therein the Menu Items I will be executing. Is this a folder of scripts, which I might name such as FullScreenMode.js –
app.execMenuItem("FullScreenMode");and PreviousPage.js –
app.execMenuItem(“PrevPage”);
- Or is it a list of the privileged language-independent Menu Item Names, e.g. FullScreenMode, PrevPage, SinglePage, OneColumn, which I seek to 'un-privilege' ?
- In either case, when I set up the button action: 'Run a JavaScript', would I be typing a script filename, or the app.execMenuItem() command of the now-unprivileged action ?
– – –
It could be that I'm off track, still. I noted no requirement of whitelisting to add a script to Document JavaScripts [re app.execMenuItem("Find"); -- posted by Gilad, 9-14-21, "Find Tool auto-open"]. But I was unable to replicate jimmyd88's success, with the function executing upon document open. However, with app.execMenuItem("Find"); fired from the Console, the Find window does appear.
And when I do the equivalent with app.execMenuItem(“PrevPage”); , here's what the Console reports [which I took to be perhaps from non-whitelisting, but that doesn't jibe with the behavior of app.execMenuItem("Find")]:

Some pointers would be most welcome.
– BR
