Skip to main content
November 26, 2009
Answered

howto add menu item to bridge

  • November 26, 2009
  • 1 reply
  • 1570 views

How do I define a new jsx file I created as a menu item within bridge?  Documentation says to look at sample snpaddmenuitem.jsx, but I cannot find it within my sdk sample list.  Thank you in advance for any assistance.

This topic has been closed for replies.
Correct answer Paul Riggott

You could just alter the script and use another ID or you could check and see if the ID was in use first...

//MenuElement.remove(id); // to remove item but next time the script is loaded it would be back.

//MenuElement.create( type, text, loc, id );

var MenuExists = MenuElement.find ("myMenuID");
if(!MenuExists) {
alert("Menu item does not exist");
}else{
  alert("Menu item does exist");
}

.

1 reply

Paul Riggott
Inspiring
November 26, 2009

Here are a couple of examples..

#target bridge  
   if( BridgeTalk.appName == "bridge" ) { 
addInfo = new MenuElement("command", "Details of What it Does", "at the end of Thumbnail");
}
addInfo .onSelect = function () {
   myFunction();
}
function myFunction(){
//Add your code here
}

///////////  Example with new Menu
#target bridge  
   if( BridgeTalk.appName == "bridge" ) {
      newMenu = new MenuElement( "menu", "Paul\'s Tools", "after Help", "myMenu" );
      RPP = new MenuElement( "command", "Reset Photoshop Preferences", "at the end of myMenu","myAlert"  );
      };

RPP.onSelect = function () {
runMyScript();
}
function runMyScript(){
//add your code here
}

November 30, 2009

Is there a clean recovery option if menu items are added incorrectly?  How do I discern the id of the new menu item to delete it?  I have been reluctant to pull the trigger on this.

Paul Riggott
Paul RiggottCorrect answer
Inspiring
November 30, 2009

You could just alter the script and use another ID or you could check and see if the ID was in use first...

//MenuElement.remove(id); // to remove item but next time the script is loaded it would be back.

//MenuElement.create( type, text, loc, id );

var MenuExists = MenuElement.find ("myMenuID");
if(!MenuExists) {
alert("Menu item does not exist");
}else{
  alert("Menu item does exist");
}

.