Jump to content

Using Applescript to check if Menu Item enabled?

Recommended Posts

I am using Applescript to check if menu item is enabled, e.g. is Obj Info palette checked or unchecked. I can then pass that value to an if-then step.

This is what I have tried running:

  • tell application "System Events"
  • tell process "Vectorworks 2017"
  • get value of menu item "Object Info" of menu item "Palettes" of menu "Window"
  • end tell
  • end tell

When I run this I am getting error: "System Events got an error: Can’t get menu "Window" of process "Vectorworks 2017".


The main menu item is "Window" so anyone know what I am doing wrong?


See attached pics





Element Path.png

Menu Path.png

Edited by Michael Gilbert
Clarify question
Link to comment

The following seems to get what you want. It return the check mark character if it is selected or Missing Value if it is unchecked.


If you are going to do much GUI scripting, I strongly recommend that you get a copy of UIBrowser from pfiddlesoft.com. It makes working out this type of code possible if not easy.


tell application "System Events"
	tell application process "Vectorworks 2018"
		get value of attribute "AXMenuItemMarkChar" of menu item "Object Info" of menu 1 of menu item "Palettes" of menu 1 of menu bar item "Window" of menu bar 1
	end tell
end tell

make sure you remove the - at the line break in the middle of Ob-ject it should all be a single line of code.


Ask again if you need more help.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...