Skip to main content
11월 26, 2009 12:06 오전 UTC
해결됨

howto add menu item to bridge

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.

이 주제는 답변이 닫혔습니다.
Paul Riggott
Inspiring
11월 30, 2009 10:58 오후 UTC

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");
}

.

5 답변

Paul Riggott
Inspiring
11월 26, 2009 8:35 오전 UTC

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
}

번역
11월 30, 2009 5:04 오전 UTC

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
Inspiring
11월 30, 2009 10:58 오후 UTC

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");
}

.

번역