Posted By

brandonjp on 03/22/11


Tagged

menu applescript function gui fn


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

riothero


Applescript function to check if an application menu item exists


 / Published in: AppleScript
 

only handles one sublevel for the menu

  1. -- brandonjp 201103211048
  2. -- applescript function to check if a menu item exists?
  3. -- returns true or false
  4.  
  5. if menuItemExists({"timeEdition", "Extras", "Start Recording"}) then
  6. display dialog "hoda"
  7. end if
  8.  
  9.  
  10. on menuItemExists({appName, menuName1, menuItem1})
  11.  
  12. tell application "System Events"
  13.  
  14. tell application process appName
  15.  
  16. if menu item menuItem1 of menu 1 of menu bar item menuName1 of menu bar 1 exists then
  17. return true
  18. else
  19. return false
  20. end if
  21.  
  22. end tell
  23.  
  24. end tell
  25.  
  26. end menuItemExists

Report this snippet  

You need to login to post a comment.