How to invoke a plug-in menu item via Javascript?

Hi, I installed a plug-in on my Acrobat Pro v11, it shows a plug-in menu, and there's one menu item in this plug-in menu dropdown. I can manually select that menu item and it does what it's designed to do.
My question is, how do I use javascript to invoke it, to achieve the same result as when I manually select that menu item?
I tried using this "app.execMenuItem("name-of-menu-item");" under my click event of a button on the PDF form, but it didn't work.
What have I done wrong? How to make it work?
TIA

Thanks to all those who responded.
Actually I got it working soon after I posted the question.
However, I don't know, my trial&error way seems to be a little different from all those documents I read. 
So, I am not exactly sure if it's the correct way to do this sort of thing or not.
It certainly is not very end-user friendly IMHO.  
I will describe what I did below, if you know of a better way, please let me know, thank you.
First, I put a folder-level script in the Acrobat install folder, the so-called "app" level;
because when I used the getPath("user", "javascript") call, it returned an error without giving me the user-level path. 
Anyway, my script (the .js file) looks like this:
xyz = app.trustedFunction(
             function() {
              app.beginPriv();
              app.execMenuItem("ADBE:myxyz");
              app.endPriv();
              return;
Then, on my form's button-click event, I make a call
  xyz();
and that got it to invoke the menu item "myxyz" successfully.
But... I can't say I like my solution:
1) I don't like the .js file, because I'll have to put it in all my users' Acrobat install folders.
     Extremely inconvenient.
     Is there a way to make it work without using the folder level script???
2) The script itself, I am not sure if it makes sense or not.
     I can't say I understand all these trustFunction and Security stuff;
      it just so happened that it worked for me, but I don't know why.
      so, maybe there could be a simpler script that can also work?
3) If I put the "beginPriv()" , "execMenuItem()" and "endPriv()" lines directly in the Button-click event,
      I got an error message in the Acrobat console, something like:  "your security settings does not allow....";
      in fact, I tried many many different ways to write this Button-click script, none of them worked without the folder-level .js file.
      But I hope somebody could come up with a way to make it work without the folder-level script file....
      Is there a way to change the "security settings" without using the .js file?
4) The execMenuItem is also a headache, sorry about complaining... but... sometimes it just silently exited without doing anything,
      and without returning any error messages... how am I supposed to know what went wrong when it's so quiet?!
       Furthermore, why does it insist on taking the full name of the menu item?  I mean, why do I must put the "ADBE:" part in there?
      there's no other menu item named "myxyz", right?
      I remember Adobe's founders once said that "making our customers' lives easier" was what drove them to work everyday.
      execMenuItem() certainly didn't listen to what they said.

Similar Messages

  • How to un-checked the sub-menu items in the active document?

    Can anybody let me know, how to make the "checked" sub-menu items in "Window" menu to "un-checked" through scripting. More clearly, i need to open a document alone without showing the tools bars, Document info, etc. Kindly help me the possiblities via scripting(vbscript / javascript). I am using illustrator cs3.
    Thanks...

    With vb you could call an action that changes the workspace. I do this with AppleScript but its only any use for in-house stuff where I know the actions and workspaces are saved.

  • How to create a cursor in menu item???

    Hi,
    How to create a cursor in menu item??? and process data inside the SQL Editor of Menu Item>????
    Regards,

    ok, you mean: When the form is starting you want to disable some menues.
    create a WHEN-NEW-FORM-INSTANCE-trigger in your form and then do the loop over the menu-item
    what is ENTITIES? The name of a table ?

  • How to disable and hide the menu items of 'copy From' button of Goods Recei

    hi expert,
    I am new in SAP B1. so please help me.
    Q:How to disable and hide the menu items of 'copy From' button of Goods Receipt PO form?
    Regards
    sanoj

    Hi Sanoj,
    Try This.....
    If pVal.FormType = "143" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE And pVal.BeforeAction = False Then
                oform = sbo_application.Forms.GetFormByTypeAndCount(pVal.FormType, "1")
                Dim oitem As SAPbouiCOM.Item
                oitem = oform.Items.Item("10000330")
                'To Disable the button
                oitem.Enabled = False
                'To hide the button
                'oitem.Visible = False
            End If
    Thanks
    Shafi
    Edited by: shafi_sunshine on Sep 15, 2011 7:35 AM

  • How to access the value of application item in javascript

    How to access the value of application item in javascript?

    Hi,
    One way
    var myVariable = '&MY_APP_ITEM.';Br,Jari

  • How to Remove the 'Bookmarks Toolbar' menu item in Firefox 8?

    I have Firefox 8 on my Windows 7 machine, and I'm trying to get rid of the 'Bookmarks Toolbar' Menu Item. I'd found a way, way back, to do that in an earlier version of Firefox on my XP PC, but I couldn't find anything on the web on how to do this in this release of Firefox.
    I'm also having trouble getting rid of "Subscribe to this page" menu item.
    Thanks for any help.
    Alex

    Hi
    Try using '&otherparams=usesdi=yes' in your URL...this could solve your problem....good luck :)
    Regards
    Thobula Ramulu Rakesh

  • How to put separator lines in menu items in a gui status ?

    Hi,
    I have created gui status for my z transaction
    I need the separator lines in the menu items like it is seen in std transactions
    For example, in any screen , in the Help menu, we can see the following.
    Application Help
    SAP Library
    Glossary
    (line)
    Release notes
    (line)
    SAP Service Marketplace
    could you please help me how to put the lines ?
    thanks

    Hi,
    Goto Your GUI status.click on your  MENU bar.
    under the menu bar you will have your own menu items.
    where ever you want separator line  do the following way.
    you will have 2 columns under menu bar
    1) code
    2) text.
    under code dont put anything.
    but under text column you put dashes and enter or select right click there and choose separator line.
    you will get separator line.
    activate and run the ztcode.you will get .
    code                                            text
    Application Help                         
    SAP Library
    Glossary
    Release notes
    SAP Service Marketplace
    Thanks
    Parvathi

  • How to hide/disable menu items using Javascript in Acrobat 9 pro or later

    We just wanted to know on how to hide/disable menu items for e.g. 'Open' menu item under 'File' menu in Acrobat 9 or later on Mac using Javascript. It would be useful if you could provide if any other option is in place already.

    Not sure it will work, but you can try using the app.hideMenuItem() method. See reference here.

  • How to have some top level menu items not be hyperlinks

    I have a navigation band where 5 of the 6 top level items need to NOT be hyperlinks but simply "category titles" that you mouseover to display the submenu - which are the links to web pages.
    An example of this is on the Amazon.com home page - the items under "Shop All Departments" has categories that are not clickable, but when you mouseover display the clickable submenu.
    Is it possible to customize some but not all of the top menu items and how?
    What do I need to modify in the CSS so that the top "category title" looks/behave the submenu (same font color/bgcolor changes) but no active hyperlink?

    Here is a link to my pagewhere I am testing the navigation. Currently there is only this one page and I have <a href="#"> for the links.
    The only menu item that should be clickable in the top level is "Contact"
    Everything in the second and third level (Events > Research >...) needs to be clickable
    Everything is working as I want except that "Research" needs to be clickable
    - and I would like to have the clickable item text be underline when in the hover state but I want to get the base navigation working first
    The closest matching code I found in the CSS is:
    #MenuBar1 li .MenuBarItemSubmenu,
    #MenuBar1 li ul li .MenuBarItemSubmenu {
        cursor: default;
    If I remove this, all the top level items become clickable. Let me know if there is other information you need. I super appreciate your help with this!

  • How to make the spacing between menu items equal with varied menu item sizes

    If the title isn't clear, what I mean is how do you make the space between each of the items in a horizontal the same when some of the menu items are up to double the size of others. Currently I am using the margin property and the space between the larger items is smaller than between the smaller items.
    If you need more information just ask.

    Screenshots don't tell the whole story which is contained in your HTML and CSS code.
    Without a link to your test page or a look at your code (all of it) the best we can provide is wild guesses.
    Help us help YOU by providing a link.
    HOW IMPORTANT IS CODE? A Plea to new posters.
    http://forums.adobe.com/thread/691654?tstart=0
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • How do I remove the "Yahoo" Menu Item from the Menu Bar

    My Text Menu Bar - NO ICONS - Reads from Left to Right:
    File, Edit, View, History, Bookmarks, Yahoo, Tools, Help -
    After I updated to Firefox 5.
    How do I get rid of the "Yahoo" Menu Item

    You appear to be first to mention the Yahoo menu item of those I've seen here, and there are some different versions of the '''Yahoo Toolbar''' maybe you have a different extension but this is how it goes for the Toolbar. You might check for another extension that has "Yahoo" in the name and in the Control Panel.
    ''Yahoo Toolbar messes up Location Bar Search''
    '''Remove the Yahoo Toolbar'''
    # "Ctrl+Shift+A" (Add-ons Manager)
    # Select Puzzle piece on left-side for Extensions List
    # Find "Yahoo Toolbar" and click on "Uninstall" button, and restart Firefox. ''(if you really need to keep the Yahoo toolbar, you can hide the toolbar instead with customize, and still change all the search defaults as below)''
    '''Then to fix the default search engine''' used at the Location Bar, change the value of '''keyword.URL''' in '''about:config''' to one of the values shown in [http://kb.mozillazine.org/Location_Bar_search#Location_Bar_search_.28external_-_search_engine.29 Location Bar search] at MozillaZine.
    * Google Search (Google search results page)<br>'''http://www.google.com/search?ie=UTF-8&oe=UTF-8&q='''
    # type in '''about:config''' into the location bar (in a new tab)
    # if the warning message nonsense comes up uncheck the box '''before''' dismissing the dialog message
    # '''filter on keyword'''
    # right-click on '''keyword.URL''' and choose "modify" then paste in the Google search engine string of your choice.
    # # '''filter on keyword'''
    # right-click on '''browser.search.defaulturl''' and again choose "modify" then paste in the Google search engine string of your choice.
    # right-click on '''yahoo.ytff.search.popup_src''' ''(if it exists)'' and again choose "modify" then paste in the Google search engine string of your choice, if adventurous might see if "reset" would remove and see if gone in next session (well not for those keeping the extension).
    '''Avoiding the problems:''' Many software installations contain additional baggage know as crapware. The Yahoo Toolbar is packaged with Java [http://imageshack.us/photo/my-images/266/javainstall.png/ picture]
    More information on ask.com, Yahoo Toolbars
    * Uninstalling toolbars - MozillaZine Knowledge Base<br>http://kb.mozillazine.org/Uninstalling_toolbars
    '''More information on configuration variables''' available in
    [http://kb.mozillazine.org/About:config_entries about:config entries] and for users not familiar with the process there is [http://kb.mozillazine.org/About:config about:config] (How to change).
    ''Yahoo Toolbar messes up Location Bar Search''
    '''Remove the Yahoo Toolbar'''
    # "Ctrl+Shift+A" (Add-ons Manager)
    # Select Puzzle piece on left-side for Extensions List
    # Find "Yahoo Toolbar" and click on "Uninstall" button, and restart Firefox. ''(if you really need to keep the Yahoo toolbar, you can hide the toolbar instead with customize, and still change all the search defaults as below)''
    '''Then to fix the default search engine''' used at the Location Bar, change the value of '''keyword.URL''' in '''about:config''' to one of the values shown in [http://kb.mozillazine.org/Location_Bar_search#Location_Bar_search_.28external_-_search_engine.29 Location Bar search] at MozillaZine.
    * Google Search (Google search results page)<br>'''http://www.google.com/search?ie=UTF-8&oe=UTF-8&q='''
    # type in '''about:config''' into the location bar (in a new tab)
    # if the warning message nonsense comes up uncheck the box '''before''' dismissing the dialog message
    # '''filter on keyword'''
    # right-click on '''keyword.URL''' and choose "modify" then paste in the Google search engine string of your choice.
    # # '''filter on keyword'''
    # right-click on '''browser.search.defaulturl''' and again choose "modify" then paste in the Google search engine string of your choice.
    # right-click on '''yahoo.ytff.search.popup_src''' ''(if it exists)'' and again choose "modify" then paste in the Google search engine string of your choice, if adventurous might see if "reset" would remove and see if gone in next session (well not for those keeping the extension).
    '''Avoiding the problems:''' Many software installations contain additional baggage know as crapware. The Yahoo Toolbar is packaged with Java [http://imageshack.us/photo/my-images/266/javainstall.png/ picture]
    More information on ask.com, Yahoo Toolbars
    * Uninstalling toolbars - MozillaZine Knowledge Base<br>http://kb.mozillazine.org/Uninstalling_toolbars
    '''More information on configuration variables''' available in
    [http://kb.mozillazine.org/About:config_entries about:config entries] and for users not familiar with the process there is [http://kb.mozillazine.org/About:config about:config] (How to change).

  • How to invoke windows file properties menu

    Can we invoke windows file properties menu (just same as right click a file in windows explorer and click properties) in a java program, eg. using shell32.dll?
    Please help!

    Hi Joanne,
    I can't figure out what exactly you're trying do to but just in case... you may simulate a right click using java.awt.Robot class.
    Best regards,
    Lionel Badiou
    CodeFutures -
    Java Code Generation
    http://www.codefutures.com

  • How to make a fly-out menu item checked?

    Hi,
    is there a way to make a fly-out menu item (coming from an XML list) checked - like in this example:
    by the way, I know it's been submitted as a bug already, but fyi sub-menu items (2-1 in the following example) don't work as expected:
    var xmlMenu:XML =
        <Menu>
          <MenuItem Id="item_1" Label="Item 1"/>
          <MenuItem Label="Item 2">
            <MenuItem Label="Item 2-1"/>
          <MenuItem/>
          <MenuItem Label="---"/>
          <MenuItem Label="Item 3"/>
         </Menu>;
    Thanks in advance!
    Davide

    If Harbs says nope, it's nope
    At least now I know it. Thanks!
    Davide

  • How to eliminate leading space in menu item.

    Hello,
    I'm using JDeveloper 11.1.1.4.0.
    I have created menu dynamically, using RichCommandMenuItem in my bean class. Menu gets generated and works as per requirement.
    Menu items however, display some leading space as seen in 'Screenshot(s)' section on the link given below.
    http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_commandMenuItem.html
    I am required to remove this leading space from menu items.
    Options that I tried:
    1. Override CSS classes in skin
    2. use setInlineStyle("") method of RichCommandMenuItem. I passed an empty string.
    Neither of these gave me required results.
    Perhaps I should pass some specific string such as "::icon:none".
    Appreciate your suggestions.
    Amar

    Hi,
    I hope you can remove leading white space as inlineStyle="margin-left:-10px;" for menu items.
    Edited :check
    http://jdevadf.oracle.com/adf-richclient-demo/faces/components/skinningKeys/menuBar.jspx?_afrRedirect=63726517039949

  • Is there a video tutorial which shows how to manually assign pages to menu items?

    I have a need to build out two separate menus. In order to do that, I need to be able to manually assign pages to the menu. Thanks

    Here's a tutorial on adding a Manual horizontal menu widget that should help - http://www.adobekb.com/building_your_first_website_pt07.html#addingmanual.
    Basically you just need to switch to a Manual menu type through Menu options, select the menu item and link/edit its label. You add more menu items to the menu by hitting the + symbol that appears when a menu item is selected.
    Thanks,
    Vinayak

Maybe you are looking for