Return to Snippet

Revision: 43322
at March 22, 2011 01:53 by brandonjp


Initial Code
-- brandonjp 201103211048
-- applescript function to check if a menu item exists?
-- returns true or false

if menuItemExists({"timeEdition", "Extras", "Start Recording"}) then
	display dialog "hoda"
end if


on menuItemExists({appName, menuName1, menuItem1})
	
	tell application "System Events"
		
		tell application process appName
			
			if menu item menuItem1 of menu 1 of menu bar item menuName1 of menu bar 1 exists then
				return true
			else
				return false
			end if
			
		end tell
		
	end tell
	
end menuItemExists

Initial URL

                                

Initial Description
only handles one sublevel for the menu

Initial Title
Applescript function to check if an application menu item exists

Initial Tags
function

Initial Language
AppleScript