Message Board for Rorohiko Workflow Resources
https://www.rorohiko.com/cgi-bin/yabb2/YaBB.pl
General Category >> General Board >> How to add menu items outside the API menu
https://www.rorohiko.com/cgi-bin/yabb2/YaBB.pl?num=1155162720

Message started by Kris Coppieters on 08/10/06 at 10:31:59

Title: How to add menu items outside the API menu
Post by Kris Coppieters on 08/10/06 at 10:31:59
It is possible to add menu items that appear outside of the 'standard' API menu.

In order to do so, you need to know the 'absolute menu path' that leads to the location of the new menu item.

Menu paths are a bit like file paths - they show how menu items are nested, and you can use either relative
or absolute paths.

Path components are separated by colons, and the registerMenuItem method interprets menu items without any colons as being relative to the API menu. If the menu item has any colons, it will be interpreted as an absolute path.

The following paths are of particular interest:

 Main:0x90B50kActivePageItemMenuKey:
 Main:&Edit:Preferences:

The first path is the absolute path to the API menu item itself. The second is the absolute path to the InDesign preferences menu.

Prefixing your menu items with these path expressions allows you to use submenus and create preferences menus. A few examples (taken from our freebie plug-ins):

   gChatterGoofyPlugin.registerMenuItem(
     "menuChatterGoofyPrefs",
     "Main:&Edit:Preferences:ChatterGoofy Prefs...");


This adds a new menu item to the InDesign preferences menu.


   thePlugin.registerMenuItem(
      "menuStoryLeftPark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Park Story Left");
   thePlugin.registerMenuItem(
      "menuStoryRightPark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Park Story Right");
   thePlugin.registerMenuItem(
      "menuStoryRePark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Repark Story");
   thePlugin.registerMenuItem(
      "menuStoryUnPark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Unpark Story");
   thePlugin.registerMenuItem(
      "menu-StoryParker-1",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:-");
   thePlugin.registerMenuItem(
      "menuLeftPark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Park Left");
   thePlugin.registerMenuItem(
      "menuRightPark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Park Right");
   thePlugin.registerMenuItem(
      "menuRePark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Repark");
   thePlugin.registerMenuItem(
      "menuUnpark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Unpark");
   thePlugin.registerMenuItem(
      "menu-StoryParker-2",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:-");
   thePlugin.registerMenuItem(
      "menuAllUnpark",
      "Main:0x90B50kActivePageItemMenuKey:StoryParker:Unpark all");


This builds up the Story Parker menu as a submenu of the API menu. Note the use of '-' as a menu item to get menu separators, and the fact that the 'StoryParker' menu itself does not need to be created - simply creating one of its submenus causes it to be created as well.



Title: Re: How to add menu items outside the API menu
Post by Siva Rama Krishna on 07/30/11 at 17:42:46
My requirment is i want "Script" menu item like API menu seperately
can you pls help  meeee

Title: Re: How to add menu items outside the API menu
Post by Kris Coppieters on 07/30/11 at 18:31:47
Hi Siva Rama Krishna,

Could you explain why the information already given does not work for you? All you need is there.

Make sure to study the material that comes with the APID Developer Toolkit thoroughly and to work through the cookbook, then apply the information in this post.

Cheers,

Kris

Title: Re: How to add menu items outside the API menu
Post by Siva Rama Krishna on 08/01/11 at 16:53:35
can you pls provide me a example of this menu entry instead of the 'API' menu

Title: Re: How to add menu items outside the API menu
Post by Kris Coppieters on 08/01/11 at 17:07:20
I am not sure - there is an example. What is wrong with it?

This is an extract of the first post in this thread, and it does not use the API menu.

...
Prefixing your menu items with these path expressions allows you to use submenus and create preferences menus. A few examples (taken from our freebie plug-ins):


  gChatterGoofyPlugin.registerMenuItem(
    "menuChatterGoofyPrefs",
    "Main:&Edit:Preferences:ChatterGoofy Prefs...");

...

Title: Re: How to add menu items outside the API menu
Post by Siva Rama Krishna on 08/01/11 at 17:08:16
Hi Kris Coppieters
I verified your example but plugin is created in the edit menu preferences but i want the 'Script' menu seperately like API is it possible
Thank u

Title: Re: How to add menu items outside the API menu
Post by Siva Rama Krishna on 08/01/11 at 17:13:29
Hi kris
Or can i rename the API menu is it possible
Thank u

Title: Re: How to add menu items outside the API menu
Post by Kris Coppieters on 08/01/11 at 17:28:51
To do that, you need to create a new folder called ActivePageItem in the same folder as where the APID ToolAssistant plug-in resides.

Inside that folder, you create a file MenuName.txt

This file contains a single line with a menu path - for example


Main:Scripts


would override the menu name 'API' and replace it with 'Scripts'.

Title: Re: How to add menu items outside the API menu
Post by Siva Rama Krishna on 08/02/11 at 16:19:00
Hi kris

Thank u very much it works

And i need to remove the menu APID Tool Assistant form that 'Scripts' Menu is it possible

And i need to change the Position of that 'Scripts' menu before 'Help' menu pls help me Kris

Thank u...

Title: Re: How to add menu items outside the API menu
Post by Siva Rama Krishna on 08/02/11 at 16:50:28
Hi Kris,

When i click on 'Script' Menu, I want to open a popup page with containing treeview in that popup pls help me Kris

Thank U....

Title: Re: How to add menu items outside the API menu
Post by Kris Coppieters on 08/02/11 at 18:26:59
Hi Siva Rama Krishna,

Sorry, but I cannot give you too much more help; I am a very busy person, and I make a living writing scripts for other people, so please don't expect for me to write too much code for you.

I can give you hints and point you in the general direction, but you'll have to do most of the work yourself - and that includes reading documentation, and studying the available material.

I don't know much of what you're working on, but my hunch is that you might need to look into the 'standard' ExtendScript menu handling features to accomplish what you want - i.e. you don't need APID ToolAssistant for adding menu items; this APID feature is a leftover from the days of InDesign CS and CS2 when ExtendScript was not as powerful as it is now. A lot of APID ToolAssistant's features have been superseded by ExtendScript's more recent standard features.

If you feel you need more help than you can find in the Adobe ExtendScript documentation, on the forums, or on this message board and the APID Documentation, feel free to send us a project brief at [email protected] and we'll gladly provide you with a cost estimate.

Cheers,

Kris

Title: Re: How to add menu items outside the API menu
Post by Siva Rama Krishna on 08/02/11 at 21:27:54
Hi kris,

1) I need to remove the menu APID Tool Assistant form that 'Scripts' Menu is it possible

2) I need to change the Position of that 'Scripts' menu before 'Help' menu

3) When i click on 'Script' Menu, I want to open a popup page with containing treeview in that popup

Pls help me for these questions only kris...

Because i am totally new for this technology and ExtendScript too, so i need ur help pls understand and answer my questions

Thank U......

Message Board for Rorohiko Workflow Resources » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2024. All Rights Reserved.