Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using name key form with menus



Hello,

The main menu is the menu which contains all the other menus of the application like File, Window etc. By default the title of the main menu (which you can't see when using the application) is MMainMenu. I want to refer to it because if I want to remove a menu item from a menu I need to be able to qualify which menu item to remove using the whole something of itscontainer syntax. I was just using the main menu as a very simple example to show that the name key form doesn't seem to work with menus.

Maybe for a more detailed example:
display alert ((title of (menu item 1 of menu 1 of main menu)) as string)
works, and will give About NewApplication or whatever the about menu item is titled.

Whereas if I gave the NewApplication menu a name in Interface Builder and used that instead:
display alert ((title of (menu item 1 of menu "appMenu" of main menu)) as string)
I get: Can’t make «class titl» of «class menI» 1 of «class menE» "appMenu" of «class maiM» of «script» into type string. (-1700)

Which doesn't seem to tell me much other than it doesn't work, as I know the thing I'm trying to reference can be a string because it worked in the example before.

I hope that clarifies what I was trying to talk about.

Again thanks if anyone can help.

Fergal



On 18 May 2008, at 10:22, Benjamin Dobson wrote:

I don't have a clue what you're talking about. I tried "display alert (title of main menu as string)" and it came up with "AMainManu". What is the main menu and why to you want to refer to it?
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >Using name key form with menus (From: Fergal Hainey <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.