Skip navigation
Currently Being Moderated

Problem while adding menu item

Jun 20, 2012 10:12 PM

Tags: #cs6 #menubars

Hi All,

 

I am working on a plugin for adobe illustrator CS6 by using adobe CS6 SDK. By using this plugin I need to add a Me nu Item In File Menu of Adobe Illustrator.

I have used the following code for this:

 

______________________________________________________________________ ________

SPBasicSuite *mBasic = message->d.basic;

    AIMenuSuite *sAIMenu;

    mBasic->AcquireSuite(kAIMenuSuite,kAIMenuVersion, (const void**)&sAIMenu);

    SPPluginRef plugin;

    AIPlatformAddMenuItemDataUS menuData;

    AIPlatformAddMenuItemDataUS pluginMenuData;

    const char *menuGroupCStr = "MyGroup";

    const char *menuCStr = "Menu...";

    const char *pluginCStr = "MMMEEENNNUUU";

    menuData.groupName = kEditMenuGroup;

    menuData.itemText = ai::UnicodeString(menuCStr);

    pluginMenuData.groupName = menuGroupCStr;

    pluginMenuData.itemText = ai::UnicodeString(pluginCStr);

    const char *Key=NULL;

    AIMenuItemOption options=kMenuItemIsSeparator;

    //AIMenuItemHandle *menuItem;

    AIErr err = sAIMenu->AddMenuItem(message->d.self,NULL,&menuData,0,&g->showMenuIte m);

    if (error) goto error;

______________________________________________________________________ ________

 

 

But i have nothing as output. Can any of you please suggest me that what should i do in this code.

 

 

 

 
Replies
  • Currently Being Moderated
    Jun 21, 2012 8:04 AM   in reply to Harsh V Sharma

    The code looks mostly right. pluginMenuData & menuGroupCStr don't actually get used, so you can cut them out

     

    That said, it looks like you're adding the menu item to the Edit Menu, not the File Menu. So you're probably looking for it on the wrong menu. If you want it on the File menu, you'll need to specify the sub-group on that menu you want it to appear in. That's the group that starts with kOpenMenuGroup and ends with kSendMenuGroup in AIMenuGroups.h.


    First though, see if its showing up in the Edit menu! If that's working, you just need to adjust your target group and you're good to go.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 22, 2012 7:00 AM   in reply to Harsh V Sharma

    SPBasicSuite* sBasic = message->d.basic;

    AIMenuSuite* sAIMenu = 0;

    sBasic->AcquireSuite(kAIMenuSuite,kAIMenuVersion, (const void**)&sAIMenu);

     

    AIPlatformAddMenuItemDataUS menuData;

    menuData.groupName = kOpenMenuGroup;

    menuData.itemText = ai::UnicodeString("My test menu...");

     

    const AIMenuItemOption options = 0;

    AIMenuItemHandle menuHandle = 0;

     

    AIErr error = sAIMenu->AddMenuItem(message->d.self, 0, &menuData, options, &menuHandle);

    // check error

     

     

    This is basically what I do in my stuff. That should create a menu in the 'File' menu, near the top.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2012 6:59 AM   in reply to Harsh V Sharma

    I have no idea how to do that in Illustrator. I'm not even sure if its possible. You can invoke actions, and those can probably run scripts.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 11, 2012 1:42 AM   in reply to Harsh V Sharma

    H Harsh,

     

    Am a newbie using the Adobe illustrator CS4. Am actually trying to customize the menu by addign a plugin.I have downloaded the SDK for doing the same. I see that you are already adept at that.If you can send me a step by step procedure to create a Custom Menu Item it would be of great help to me.

     

    regards

     

    Shyam

    Shyamnguitar@gmail.com

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 11, 2012 6:56 AM   in reply to samnguitar

    Just check the sample code. Most of the plugins in there have to create menuitems to let you run their samples.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points