Copy link to clipboard
Copied
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:
app.execMenuItem("FullScreenMode");
and PreviousPage.js –
app.execMenuItem(“PrevPage”);
– – –
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
Copy link to clipboard
Copied
Your console shows a syntax error. You should believe this, not chase white lists unrelated to getting the syntax right. (You may need that later, but one thing at a time). Look very closely at your screen shot and you can see the double quotes around PrevPage are not the same as each other. These are typographic quotes, and neither one is the simple double quote you need - you can see all three kinds in your post. This commonly happens when scripts are composed in a word processor, as word processors often "improve" quotes. It's also a hazard when copying and pasting code eg from a blog.
Copy link to clipboard
Copied
My code did not contain these quotes. They were added by whoever copied and edited it. My guess is they used Word, instead of a plain-text editor.
Copy link to clipboard
Copied
try67 -- Yes, that "whoever copied and edited it" would be me. But I didn't even gain the benefit of copying your code verbatim.
I had retrieved the names, thanks to Thom’s Acquiring Menu Item Names for Acrobat.pdf, but was initially unaware of the need for quotes in the function. And when I added them, even though in TextEdit, I failed to insure plain text characters, and to review sufficiently closely.
Copy link to clipboard
Copied
I cowered a tad, when I saw them big green tires riding up at me. I am familiar with a degree of frankness in your posts, across the forum. But your counsel to "Look very closely" was 'spot on'. Likewise, interpreting Console error reporting. Would that I were advanced enough to differentiate syntax flaws, from other objections. I'm on a steep learning curve here. Jeesh -- though I've kicked scripts about, a bit, it was only last night that I really got to grok the Console, thanks to Thom's The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript).
My sense that perhaps I was off track over white lists for execution of Menu Items might have been legacy paranoia dating to Acrobat 7, or sumpin'. I'll test if I'm on track.
Copy link to clipboard
Copied
You don't need a whitelist nor privileges nor app.execMenuItem to use such basic functions.
// previous vue:
app.goBack();
// previous page:
this.pageNum--;
// next page:
this.pageNum++;
// first page:
this.pageNum = 0;
// last page:
this.pageNum = this.numPages - 1;
// full screen mode:
app.fs.isFullScreen = true;
// 100% zoom
this.zoom = 100;
Copy link to clipboard
Copied
Straight and to the point, man.
Last night, you sold me on BBEdit 14.0.1, which I obtained in preparation for external-folder scripts which, as you adroitly advise, are a moot point point when it comes to these functions [but "bound to be of benefit", to quote TEST SCREEN NAME]. And donchaknow, I had already used app.fs.isFullScreen, successfully.
Copy link to clipboard
Copied
How to use the child menus from the app. Execmenuitem(stampname) newly created stamps came in thirld level child it is not working in the open file function
Copy link to clipboard
Copied
I knew I was asking in the right place. My heartfelt appreciation is earnestly expressed in regards to y'all's prompt replies. (I'd have said so sooner, except that the 'Email me when someone replies' checkmark seems here recurrently unpredictable.) I am now right on target — BINGO !