• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: enable menu item in applescript studio
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enable menu item in applescript studio


  • Subject: Re: enable menu item in applescript studio
  • From: Bart-Jan Schuman <email@hidden>
  • Date: Sat, 2 Feb 2008 19:10:11 +0100

hi Andrew,

On 2 feb 2008, at 17:19, email@hidden wrote:
So I gather it's not impossible, just difficult?
Neh, its really doable. I figured it out, there: so can you ;-)
Hopefully the following will point you in the right direction ....

Does anyone have an example of a custom menu item that starts off disabled but can be dynamically enabled once a user authenticates via a panel window?
I would put the code which checks for the authentication in a handler called "update menu item".
In the (new) Interface Builder (IB from XCode 3.0) that can be found under "Tools", using the "AppleScript Inspector".


Just:
Open your "MainMenu.nib" file, by double clicking in XCode/ AppleScriptStudio, in IB
- select your "custom menu item", hit Cmd-7, then
- give your item a "Name"
- specify a script file where you want IB to put the handler code in,
- "open" the handlers for "Menu" and enable/check "update menu item"
- save your nib-file


Switch back to XCode and
- look in the source file you specified above for

   on update menu item theObject

   end update menu item

- and put in something like:

   on update menu item theObject
	-- assuming your "panel window" set a boolena like ...
	if theUserAuthenticated then
		return true -- to enable the item
	else
		retrun false -- to leave the item disabled
	end if
   end update menu item


Any help would be appreciated. Thanks.
Hope this helps.
Feel free to let me know I did not explain correctly (enough) and I'll get back to you.


Happy coding,


Bart-Jan.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Prev by Date: Scripting Entourage Account creation and deletion
  • Next by Date: Re: tone of text? was UUID
  • Previous by thread: enable menu item in applescript studio
  • Next by thread: Re: tone of text? was UUID
  • Index(es):
    • Date
    • Thread