Help Adding Menu Items to Bridge

I've created (modified) a couple of Bridge Scripts and finally have them working nicely. Now, I want to add a couple of Menu Commands to execute them. I tried modifying a script in the SDK, SnpAddMenuItem.jsx, which would work fine if I only had one Menu Item/Command. Here is what I have. I obviously don't understand the 'this' object or how to separate the Commands. Help much appreciated.
function SnpAddMenuItem()
          this.requiredContext = "\tAdobe Bridge must be running.\n\tExecute against Bridge CS5 as the target.\n";
          this.menuID = "snpAddMenuItem";
          this.menuCommandID = "snpAddMenuItemSub";
          $.level = 1; // Debugging level
SnpAddMenuItem.prototype.run = function()
          var retval = true;
          if(!this.canRun()) {
                    retval = false;
                    return retval;
    var newMenu = new MenuElement( "menu", "Scanning", "after Window", this.menuID );
    var stackCommand = new MenuElement( "command", "Gather NNYY Into Stacks", "at the end of " + this.menuID, this.menuCommandID );
    var maskCommand = new MenuElement( "command", "Process Stacks into Layers", "at the end of " + this.menuID, this.menuCommandID );
          stackCommand.onSelect = function()
                    var scriptFilePath = "~/Documents/Adobe Scripts/AutostackNNYY.jsx";
         var scriptFile = new File (scriptFilePath);
         $.evalFile( scriptFile );
    return retval;
          maskCommand.onSelect = function()
                    var scriptFilePath = "~/Documents/Adobe Scripts/StacksToLayers.jsx";
         var scriptFile = new File (scriptFilePath);
         $.evalFile( scriptFile );
          return retval;
  Determines whether snippet can be run given current context.  The snippet
  fails if these preconditions are not met:
  <ul>
  <li> Must be running in Bridge
  <li> Must only be executed once in a session
  </ul>
  @return True if this snippet can run, false otherwise
  @type boolean
SnpAddMenuItem.prototype.canRun = function()
          // Must run in Bridge
          if(BridgeTalk.appName == "bridge") {
                    // Stop the menu element from being added again if the snippet has already run
                    if((MenuElement.find(this.menuID)) && (MenuElement.find(this.menuCommandID)))
                              $.writeln("Error:Menu element already exists!\nRestart Bridge to run this snippet again.");
                              return false;
                    return true;
          // Fail if these preconditions are not met. 
          // Bridge must be running,
          // The menu must not already exist.
          $.writeln("ERROR:: Cannot run SnpAddMenuItem");
          $.writeln(this.requiredContext);
          return false;
  "main program": construct an anonymous instance and run it,
  as long as we are not unit-testing this snippet.
if(typeof(SnpAddMenuItem_unitTest ) == "undefined") {
          new SnpAddMenuItem().run();

This will put the two commands at the bottom of the Tools menu....
#target bridge  
   if( BridgeTalk.appName == "bridge" ) { 
var stackCommand = new MenuElement( "command", "Gather NNYY Into Stacks", "at the end of Tools","uniqueId1");
var maskCommand = new MenuElement( "command", "Process Stacks into Layers","at the end of Tools","uniqueId2");
stackCommand.onSelect = function () {
//Your code goes here
maskCommand.onSelect = function () {
//Your code goes here

Similar Messages

  • Calling a dll from a new menu item in Bridge.  Idiot help needed

    Hi,
    I'm trying to what I believe is a fairly simple script.  I'm coming from a hobbiest Delphi background, and to be honest I'm finding JavaScript a little bit hard to understand.  My requirements are simple - add a new menu item to Bridge which executes a call to a custom dll.  Note I'm not expecting the dll to return anything here.. 
    Looking at the samples provided even I can add the menu item - but getting it to successfully call the dll is a bit of a mystery. 
    The script compiles and adds the menu item, however the menu action doesn't call the dll.  I believe it should be a fairly simple task and was hoping somebody here could steer me right.  Here's my code (as you'll see a clear cut and paste job from the examples ;o)
    Header 1
    function SnpAddMenuItem()
      this.requiredContext = "\tAdobe Bridge must be running.\n\tExecute against Bridge CS6 as the target.\n";
      this.menuID = "snpmyMenu";
      this.menuCommandID1 = "snpAddMenuItemSub1";
      $.level = 1; // Debugging level
    SnpAddMenuItem.prototype.run = function()
      var retval = true;
      if(!this.canRun()) {
      retval = false;
      return retval;
      // Create the menu element
      var newMenu = new MenuElement( "menu", "myMenu", "before Help", this.menuID );
      // Create the menu item
      var alertCommand1 = new MenuElement( "command", "Load Stuff", "at the end of " + this.menuID, this.menuCommandID1);
      alertCommand1.onSelect = function (m1)
            ExternalObject.myDll = new ExternalObject('lib:/C/temp/apmDLL.dll');
            myDll.sendtoACRPM(1);
    //      return retval;
    SnpAddMenuItem.prototype.canRun = function()
      // Must run in Bridge
      if(BridgeTalk.appName == "bridge") {
      // Stop the menu element from being added again if the snippet has already run
      if((MenuElement.find(this.menuID)) && (MenuElement.find(this.menuCommandID)))
    // $.writeln("Error:Menu element already exists!\nRestart Bridge to run this snippet again.");
    // return false;
                MenuElement.remove(this.menuID);
      return true;
      $.writeln("ERROR:: Cannot run SnpAddMenuItem");
      $.writeln(this.requiredContext);
      return false;
    if(typeof(SnpAddMenuItem_unitTest ) == "undefined") {
      new SnpAddMenuItem().run();

    The dll needs to be compatable with the criteria set in the JavaScript Tools Guide. There is an example in the Bridge SDK that can be downloaded from http://www.adobe.com/devnet/bridge.html
    But it need someone who is knowledgeable with c++
    It would be great if someone could write a wrapper to access other external objects.

  • Adding menu items

    I am writing a program using netbeans. I have put in a menu bar and a menu from the palette. I don't know how to add menu items. The explanation in the tutorial says how to code it in at the place where the GUI is constructed. But this is in a blue area in the source listing and it won't let me edit it. Help.

    I am writing a program using netbeans. I have put in
    a menu bar and a menu from the palette. I don't know
    how to add menu items. The explanation in the
    tutorial says how to code it in at the place where
    the GUI is constructed. But this is in a blue area in
    the source listing and it won't let me edit it.
    Help.just look at the properties maybe you miss something or you can add
    menu items manually.

  • Adding menu items and making system calls in AfterEffects (AE,CS3)

    We are looking to do the following things via javascript in AfterEffects CS3. It does seem straight-forward, but am unable to find a good reference or example.
    * Add at startup a menu item under "File" (or similar main menu) and have it call a script function when clicked.
    * Have a script make an external system call (to launch an external application/executable with a few parameters)
    Any insights on how to achieve this?
    Many thanks!

    I wanted to see if there was any update on this, I'm writing a series of tools and would love to create a custom menu for quick and easy access.
    If it turns out there isn't an "easy" way to do this (env variables, special directory locations, javascripts) would anyone know if access to the menubar is possible from the Plugin API?
    I'm fairly new to After Effects, just getting up-to-speed on the environment now... seeing if I can duplicate the functionality of some old Nuke scripts in AE.
    thanks,
    Rick_

  • Adding Menu Items that are not pages.

    I want to add menu items that are not pages that I will create in Muse. They are linking to Wordpress pages that I have. How do I do this with a menu widget?

    Just look here:
    How can I create a hyperlink to a thirth party WEB site from Muse?

  • Problem when trying to add a link to the left menu item!!!!

    Hi everyone,
    I am trying to put a new menu group on the left menu,with a link in that group for every one.On checking with the customization guide this is what i did
    for one link i did add the following lines in each of the files
    1)xlWebAdmin.properties
    - menuGroup.Misc-Menu=Misc Menu
    - menuItem.Misc-Menu.My-Nomination=My Nomination
    2) xlDefaultAdmin.properties
    - menuItem.Misc-Menu.My-Nomination.link=mynomineefrm?showfrm
    3) repacked the war and the ear
    4) Restarted my server
    When I login into the administration(xelsysadm) page I didnt see any menu item with name "My Nomination" which i am supposed to see.
    secondly it shows the menu item when ever i select some group and click on assign menu item.
    Moreover, when I try to assign this menu item to all users group it gives me this error
    On browser it prints
    Permission Denied to Assign Selected Menu Items
    You do not have the permissions to assign one or more selected menu items.
    on console it prints
    ERROR [SERVER] Class/Method: tcDataObj/eventPreInsert Error :Insert
    permission is denied
    ERROR [APIS] Class/Method: tcGroupOperationsBean/addMenuItems encou
    nter some problems: maoRejections:You do not have permission to insert this obje
    ct.
    ERROR [APIS] Class/Method: tcGroupOperationsBean/addMenuItems encou
    nter some problems: Error occurred while adding menu items.
    ERROR [WEBAPP] Class/Method: UserGroupMenuItemsAction/commitGroupAs
    signMenuItems encounter some problems: {1}
    Thor.API.Exceptions.tcBulkException
    This problem eat my happy sunday :-(, any one has solution for this problem?
    - Also if some one can help on how to link jsp to the new link will be helpful for me!
    Thanks,
    doki

    Design Console > Form Information > add new
    Class Name Organizations.Merge
    Description Move users from one organization to another
    Type menuitem
    Add following to xlWebAdmin.properties, xlWebAdmin_en_US.properties
    Organizations.Merge=mergeOrgs.do?Display
    menuItem.Organizations.Merge.link=mergeOrgs.do?MergeOrganizations
    menuItem.Organizations.Merge=Merge
    mergeOrgs.button.display=Merge Organizations
    Even you have to assign first to System Administrator group
    First go to Manage Group
    Select System Administrator Group
    Select Menu Item
    Click Assign and select newly craeted Menu Item and click Confirm
    These are the steps to see the new menu item. To make this menu item working:
    you'll have to write action class, form bean class and you'll have to create JSPs and make their entry in struts-config as welll as in Tiles-def.xml
    Then your menu item will work.

  • My user defined menu items not shown up in Main Menu

    Hi,
    I have some my own menu items need to add into Main Menu list, it works fine but only issue is the screen flash lot. Since all the menu items are in the form called "Main Menu" form then I tried to use oForm.Freeze(true) and oForm.Freeze(false) before and after adding menu items. Now the weird thing is though the screen doesn't flash but i can't see the new added menu items in the Main Menu form. But I can see them under the system menu Modules menu. Any idea?
    Thanks!
    Lan

    Hi All,
    After check the SDK help, I found the reason. I need to call oForm.Update() after. Now it works well.
    Lan

  • Add menu item for Batch Sequence?

    Hello,
    I've created a folder level script that will execute when Acrobat starts. The script adds a menu item, that when clicked, will call another function.
    I'm wondering if I can create a batch sequence and add a menu item for that as well? I basically just want to avoid going through the whole Advanced -> Doucment Processing -> Batch processing... -> and then find the batch sequence and click Run.
    I've seen plenty of examples for adding menu items that call folder level scripts, but nothing on batch sequences. Has anyone ever done this?
    Many thanks in advance!

    You can't create a menu item to a specific batch sequence. The closest you
    can get is to open the batch sequences window, using the execMenuItem()
    method and "BatchEdit" as the name of the command (I'm not sure it's still
    the same in Acrobat X).

  • Why are iTunes, View, Window, and Help menu items disabled?

    I am frequently encountering an issue in iTunes 10.5 (141) where all the menu items in the iTunes, View, Window, and Help menus are disabled (greyed out). Why is this happening and can it be stopped?
    I've seen this issue on different Mac OS X 10.7.2 machines. It seems to occur during playlist manipulation, where I'm making new playlists, adding items to them and editing them and the items. In the worst cases, I'm forced to quit and restart iTunes, although I have to quit by using the context menu option in the Dock as the Quit option is disabled in the application.
    I'd appreciate any advice on workarounds for this that don't involve quitting and restarting iTunes.

    I'm also having the same issue.  It was happening with 10.5.1 and now still with 10.5.2.  I'm using a 2008 iMac running 10.6.8.  I do not use iTunes Match.  This seems to happen for no apparent reason i/o/w, I can't determine a pattern as to when it happens, but it occurs about once in every 10 times that iTunes is open and it seems to happen after it's been open for a while, but again, no particular pattern. 
    Sometimes, all the menu items are grayed out, and other times, 70% of the menu items are grayed out.  I can still use the other functionality in iTunes, but must must Quit from the dock (it quits gracefully and no Force Quit is necessary).  Relaunching restores eveything to normal for about a week. 
    I work with technical diagnostic issues and can usually pinpoint a problem, isolate an issue, or determine a pattern, but this one has me stumped. I thought 10.5.2 might fix it, but no.  Maybe 10.5.3?

  • New Menu Item entry in Standard Help Menu

    Hi experts,
    I have added a custom menu item under the standard Help menu of SAP using SE41 (Menu Painter) with pragram name: MENUSYST and status: MEN
    I added the new entry and gave it a function code and activated the function code as well as the interface MENUSYST.
    This worked fine and the entry is visible at the desired location. Now on click of this new entry, I need to open a URL. I had a look at the HELP_START function module but modifying that to call the URL on click of the new menu item, would require an access key.
    Is there any other method available to accomplish the task?
    Regards,
    Reema.

    Hello,
    Basically I need to open a Custom Web Dynpro Application that I have created. Also I need to pass the trannsaction code as a parameter in the URL of the WDABAP Application.
    Pl help me proceed.
    Regards,
    Reema.

  • WAD - adding menu entries with JavaScript - help please!

    Hiya,
    I am completely new to JavaScript and I need some help with adding menu entries into my WAD template. Can anyone please help?
    I want to add functionality into my WAD template to enable users adding results rows on a selected characteristic, at a single mouse click. Currently they need to go to the menu -> properties -> characteristic -> display results -> always -> ok. That's five clicks of a mouse (provided they know were to go).
    I want to add this option to the basic menu so that they can click once only.
    What I have managed to figure out so far using SAP help is the following. I have added a Script Item into my WAD Layout and added the following line of code in the Script Editing window:
    sapbi_addToMenu("Add totals", "alternate_context_menu", "X","CHARACTERISTIC", "", "bottom", "", "")
    It worked fine in that it added an extra item "Add totals" to my menu when I righclick on a characteristic. So far so good. However, I have no idea what function I should be using here, or how to code it. Surely WAD uses some function to perform this action, something that I could reuse? Is there a library somewhere of all the function used in WAD?
    Can anyone please help with the code?
    Many thanks,
    Agata

    Hiya again,
    I have managed to partially solve this problem by using the following code. However it requires me to define on which characteristic the function is performed. In this case I have managed to get it working on 0PROJECT, but I want it to be ANY characteristic which has been right clicked?
    Any ideas how I can pass the characteristic name as a VARIABLE, whose value would be read automatically when menu is triggered?
    /* Add Contextmenu entries */
    sapbi_addToMenu("Add totals", "JS_SET_RESULT_VISIBILITY_R", "X","CHARACTERISTIC", "", "bottom", "", "")
    * Javascript functions that are to be integrated into a web template and that
    * are to be used later in the web application ALWAYS have to have the same function
    * signature, i.e. the parameters that will be passed.
    * @param currentState - a list of parameters that describe the state the web item
    * @param defaultCommandSequence - the initially used sequence of commands that
    *       would have been used instead of the custom
    *       script.
    function JS_SET_RESULT_VISIBILITY_R( currentState, defaultCommandSequence ){
    //Note: information can be extracted using the parameter 'currentState'
    // and 'defaultCommandSequence'. In either case create your own object
    // of type 'sapbi_CommandSequence' that will be sent to the server.
    // To extract specific values of parameters refer to the following
    // snippet:
    //  var key = currentState.getParameter( PARAM_KEY ).getValue();
    //  alert( "Selected key: " + key );
    // ('PARAM_KEY' refers to any parameter's name)
    //Create a new object of type sapbi_CommandSequence
    var commandSequence = new sapbi_CommandSequence();
      * Create a new object of type sapbi_Command with the command named "SET_RESULT_VISIBILITY"
    var commandSET_RESULT_VISIBILITY_1 = new sapbi_Command( "SET_RESULT_VISIBILITY" );
    /* Create parameter TARGET_DATA_PROVIDER_REF_LIST */
    var paramTARGET_DATA_PROVIDER_REF_LIST = new sapbi_Parameter( "TARGET_DATA_PROVIDER_REF_LIST", "" );
    var paramListTARGET_DATA_PROVIDER_REF_LIST = new sapbi_ParameterList();
    // Create parameter TARGET_DATA_PROVIDER_REF
    var paramTARGET_DATA_PROVIDER_REF1 = new sapbi_Parameter( "TARGET_DATA_PROVIDER_REF", "DP_1" );
    paramListTARGET_DATA_PROVIDER_REF_LIST.setParameter( paramTARGET_DATA_PROVIDER_REF1, 1 );
      // End parameter TARGET_DATA_PROVIDER_REF!
    paramTARGET_DATA_PROVIDER_REF_LIST.setChildList( paramListTARGET_DATA_PROVIDER_REF_LIST );
    commandSET_RESULT_VISIBILITY_1.addParameter( paramTARGET_DATA_PROVIDER_REF_LIST );
    /* End parameter TARGET_DATA_PROVIDER_REF_LIST */
    /* Create parameter CHARACTERISTIC */
    var paramCHARACTERISTIC = new sapbi_Parameter( "CHARACTERISTIC", "0PROJECT" );
    commandSET_RESULT_VISIBILITY_1.addParameter( paramCHARACTERISTIC );
    /* End parameter CHARACTERISTIC */
    /* Create parameter RESULT_VISIBILITY */
    var paramRESULT_VISIBILITY = new sapbi_Parameter( "RESULT_VISIBILITY", "VISIBLE" );
    commandSET_RESULT_VISIBILITY_1.addParameter( paramRESULT_VISIBILITY );
    /* End parameter RESULT_VISIBILITY */
    // Add the command to the command sequence
    commandSequence.addCommand( commandSET_RESULT_VISIBILITY_1 );
      * End command commandSET_RESULT_VISIBILITY_1
    //Send the command sequence to the server
        return sapbi_page.sendCommand( commandSequence );

  • Help menu items not available Logic Pro 9

    I think this problem occured after upgrading to Mavericks. When I use the help menu in LogicPro9 and click on the most relevant keywords that I have typed I am presented with a dialog that indicates: "The selected topic is currently unavailable. The topic you were trying to view could not be found."
    I think this may be related to Spotlight not being indexed properly. After having problems re-indexing Spotlight I finally realised that in order for Spotlight to re-index correctly I had to add my permanently installed SD card to the Spotlight Privacy eclusion list. Instead of Spotlight taking 5+ hours to re-index a fast SSD it now did it in about 10mins.
    I am now confident Spotlight has re-indexed successfully.
    But the help menu items are still "unavailable"
    OSX 10.9.1
    MacBookPro Mid 2012
    Logic Pro 9.1.8

    I'm still putting this question out there to anyone who can help solve this problem. After trashing the Logic Pro9 App from the Finder>Applications I visited the Mac App Store and under the Purchases icon I re-installed Logic Pro9.
    The Help menu is still returning:
    "The topic you were trying to view could not be found." when clicking on the suggested returned results in relation to my search keywords.
    I know there are better resources out there but I find it handy to use the help menu instead of reaching for a book or website/weblink.
    Eventually I will switch to Logic Pro X but as Lennar Digital is still finalising their 64Bit version release of Sylenth (popular soft synth)  I will wait until that is completed later in the year.

  • With 3.6.12, Help menu item "For Internet Explorer Users" results in a "Page Not Found" error. Is this a known bug? Is it being addressed?

    Clicking the 3.6.12 Help menu item "For Internet Explorers" item results in a "Page Not Found" error.
    The URL of the resultant page is https://support.mozilla.com/en-US/kb/Windows%20start%20page?as=u
    Is this a known bug, if so, is it being addressed? If so, someone needs to work faster.
    If it is not a known bug, someone needs to get right on it - you want people to switch to Firefox and then there is this bug -- not a good way to impress Internet Explorer users.

    Hi Claudio Roca,
    I have encountered the same problem. Do you found the solution for this issue? I will much appreciated if you willing to share your solution and email to [email protected] Thank you so much.
    Regards,
    Hau Chee

  • Context Menu Items Gone After Running "cleaner" program. Help...

    So with the whole Flashback/Flashfake thing I paniced (stupid on my part) ran a virus program called VirusBarrier Express and ran CCleaner (again, stupid me). Hoping I would clear off unused or harmful files I apparently in the process messed up my context menu. Items that were previously in the context menu are now gone. I did as much reading about possible fixes as I could and this is where everything stands.
    Not every item in the image  below was at the botton of the context menu, but iPack certainly was as well as various other menu items that have since dissapeared.
    While searching the internet I came across a suggestion leading me to "library/Contextual Menu Items" and when I followed that directory for both my user and system I couldn't find a Contextual Menu Items folder. There wasn't any. I've had this "missing file/folder" problem before with preference files; just a side note.
    I created the folder manually and restarted with no change at all.
    Obviously I accidentally deleted something that shouldn't have been deleted. Is there any way to get back those missing items?
    Any help is highly appriciated.

    Thank you everybody for your input and advice! I've deleted the virus software, but if I use any in the future I'll be sure to have only one installed. I initally downloaded multiple ones, but only ran one (VirusBarrier).
    I restored from a Time Machine backup with the help of Apple tech support to before I ran CCleaner (never running something like that again) and the problem fixed itself.
    I will have to be far more wary of running programs in the future. Thank you again for everybody's input and advice!
    (below is what it looked like, or kind of like, before.)

  • Multiple drop down menu items to populate the a separate text box...more help please

    Thanks to Gilad D67 for showing me how to have multiple drop down menu items appear in a separate text box. This stuff blows my mind. Is there any script I can use to make a new drop down menu item appear in the same text box, but on a new line below a previous entry. For example. I select 'cat' from my drop down menu and it appears in my text box. Now I choose 'dog' from my menu and it appears in my text box like so  'cat dog.' Is there any way I can make 'dog' go straight to a new line automatically without having to manually go into the text box and change it?
    cat
    dog (new selection goes straight to a new line)
    Now, I don't have a clue if this is also possible, but imagine, I don't like my drop down menu selection of 'dog' and I go back into the menu and I change to 'rat' but in the text box, 'dog' still appears and 'rat' is added. Do I have to manually delete 'dog' from the text box or is there script that can do this for me.
    Any assistance would be incredible. It amazes me how people know this stuff.
    This is the script I have so far
    (function () {
        // Do nothing if not committed
        if (event.willCommit) return;
        // Set up an array to hold the individual paragraphs of text
        var aQuotes = [3];
        // Populate the array with the paragraph text
        aQuotes[0] = "Use common singular nouns, plural nouns [plural ‘s’] and proper names to say what things are"
        aQuotes[1] = "Use numbers 1–10 to count"
        aQuotes[2] = "Use basic adjectives and colours to say what someone/something is or has"
        // Get the selected item, which is the export value of the selected combo box item
        var item = event.changeEx
        // Display the text corresponding to the selected item in the text field
        getField("Text30").value += " " + aQuotes[item];

    You have to set the option for the text field to be multiline and then change the last line of the script to:
    getField("Text30").value += "\r" + aQuotes[item];
    To reset the field you can use a separate button with a Clear Form command, and then you just select this one field from the list.

Maybe you are looking for

  • Collective requirement for Raw materials for the whole week during mrp ru

    hi gurus,       I have a requirement like this. the raw materials required for on different requirement dates has to be clubbed together  per week and one single purchase requisition for that raw material for that week. I had created a availability c

  • Integration of SQL database with XI

    Dear All, I have a req in that I have to connect to SQL Server database to XI system then from XI to ECC. To do this what are Connection should done from DatabaseXI-ECC. I have JDBC adapter in XI.Do I need install again in XI . how we will connect SQ

  • Adding Query's in Favourite

    Hi, We have developed the reports for client. I want to know how the client will be able to access his reports as there are multiple users interested in executing there relevant report's. One way that i know is that the query's will be added in there

  • Resource definition & URL specification in ReST WS for configuration settin

    Hi All, I am working on developing a configuration management platform. This will have functions for configuration setting such as enabling logging in the system. I want to expose this configuration management service using ReST web service. I went t

  • Can Photoshop CS5 save as previous version?

    I never get any option to select a previous version when I do Save As... in Photoshop CS5. How can I do it? Is it just not able?