UI Browser

Have downloaded UI Browser but keeps crashing. Sent support request but in meantime trying to get my head round using UIElementInspector.app

Got as far as this in Applescript:

activate application "Vectorworks"
tell application "System Events"
Tell process "Vectorworks"
get value of checkbox “Object Info”

of AXMenuItem: “Object Info”
of AXMenu
of AXMenuItem: “Palettes”
of AXMenu
of AXMenuBarItem: “Window”
of action AXMenuBar
End tell
end tell

But getting error message “Expected expression, property or key form, etc. but found unknown token.”

I want to be able to use as basis for checking Palette & Menu items in if-then steps in KM macros but getting nowhere.

Watched Dan’s video which is very helpful but cannot get applescript to compile in order to check menu/button condition - mainly because have no idea what I am doing.

I know this is not applescript forum but is a step into KM so apologise in advance if should not be posting here. However, any help guidance as to what I am doing wrong would be much appreciated.

Below is the info from UIElementInspector that seems relevant.

AXApplication: “Vectorworks”
AXMenuBarItem: “Window”
AXMenuItem: “Palettes”
AXMenuItem: “Object Info”

AXRole: “AXMenuItem”
AXRoleDescription: “menu item”
AXParent: “”
AXEnabled: “1”
AXPosition: “x=788 y=70”
AXSize: “w=247 h=19”
AXTitle: “Object Info”

AXMenuItemMarkChar: “✓”

AXCancel - cancel
AXPress - press

To start with something: It’s tell (not Tell) and end (not End). And you cannot use curly quotes for strings; must be straight quotes ("").

You really should format your code as fenced code block. Copy the code from Script Editor and paste it inside three backticks, like this:


It will be much easier to read then.

You can also make macros to ease making code blocks for you. I have a palette that inserts text in my clipboard as various code blocks :

@nikivi, your screenshot shows a wrong language key. It should be applescript (lowercase).

I have now used UI Browser with Excel and works fine so I think maybe an incompatibility with Vectorworks.

Excel example:
tell application "System Events"
tell process "Microsoft Excel"
get value of radio button “Validation” of radio group 1 of window "Paste Special"
end tell
end tell

Just need to figure out how to get references for VW menu items.

First, Excel is highly scriptable, using either/both AppleScript and/or Excel VBA. So I would not use UI scripting with it unless there is definitely no other way.

When you say "UI Browser" I'm not sure if you actually mean that tool/app, or just using System Events.

If you don't own UI Browser, then I'd suggest that your invest in Script Debugger 6. It's scope is much broader than UI Browser, and it does NOT do exactly what UI Browser does, but, using SD6 Explorers you can learn a lot.

So for example, this simple script:

tell application "System Events"
end tell

without running the script, just place your cursor in the first line, and open the SD live inspector. You will see something like this:

Which shows you all UI elements currently visible (but maybe not obviously so).

You can then drill down into the UI element of interest to find what you are looking for.
If you find Vectorworks in the element list, then drill down in it.

You can also do something similar with Vectorworks:

tell application "Vectorworks"
end tell

IAC, I think you will find Script Debugger 6 useful many times a day, if you do much AppleScripting.

They do provide a free, fully functional, 30-day trial.


1 Like

Have to work on being more explicit. Yes I was referring to UI Browser by Pfiddlesoft.
This is script I am entering:

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".

Because I rarely use AS, once a year perhaps I am not familiar with syntax or

See attached pics

You forgot a couple of elements, for example menu bar 1 at the end. (Look at your screenshot from UI Browser.)

Here is an example that works for a TextEdit menu item, with a similar structure:

tell application "System Events"
  tell application process "TextEdit"
    tell menu bar 1
      tell menu bar item "Format"
        tell menu "Format"
          tell menu item "Text"
            tell menu "Text"
              tell menu item "Show Ruler"
                value of attribute "AXMenuItemMarkChar"
              end tell
            end tell
          end tell
        end tell
      end tell
    end tell
  end tell
end tell

The result is

My example is in the inverse order of yours (nested tell blocks), but you can also write it with “of…of…of…”.

This is the menu item from the example:

1 Like

Fantastic Tom.

Spent all day copying and pasting and looking at code from so many pages trying to get my head round this.

Substituted and works a treat.

Maybe now I can go to bed zzzzz! Then on to next bit.

Many thanks to everyone.


@Tom has given you the answer.

Just to follow-up on use of Script Debugger 6 in identifying UI elements, here is what I found in about 5 min using SD6. I'm providing this for you, and all readers, just so you know what SD6 can do for you.

SD6 actually displayed the elements, and then created the below code when I asked it to "Paste tell":

tell application "System Events"
  tell its UI element "TextEdit"
    tell its menu bar 1
      tell its menu bar item "Format"
        tell its menu "Format"
          tell its menu item "Text"
            tell its menu "Text"
              tell its menu item "Show Ruler"
                value of attribute "AXMenuItemMarkChar"
              end tell
            end tell
          end tell
        end tell
      end tell
    end tell
  end tell
end tell

Here's my drill-down of UI elements show by SD6 for System Events:

1 Like

Thanks. This video https://tinyurl.com/ybb8gbf7 might also be useful to others like me who have little experience. I still managed to mess up the syntax but finally got it working.

So thank you one and all.

Thanks, Michael. I was not aware of that video. It is short and to the point. Very helpful I think.