UI browser functionality

Hi: I’m a newbie to script debugger. It looks exactly what i need. I found the software through a forum stating that it has UI browser functionality. However, when i’m trying out the software, it doesn’t seem to have such functionality. I’m a bit confused. can someone point me to the correct documentation or tutorial? Thank you.

By UI browser functionality I mean the ability to browse through the UI elements of an open window and generate code that points to the element. I’m a bit new to applescript so I’m not sure if I used the correct terminology.

You’ve come to the right place. Below is copied and pasted from another thread, which describes how to access the UI actions.

In brief, the UI elements are found in Script Debugger Dictionary Explorer window, of the System Events app.

If needed I can go into more detail or post a movie.

This works for me (in Script Debugger and Script Editor):

tell application "Safari"
   activate
   tell application "System Events"
      tell its process "Safari"
         tell its menu bar 1
            tell its menu bar item "File"
               tell its menu "File"
                  click menu item "New Window"
                  click menu item 1
                  click menu item 2
                  click menu item 3
               end tell
            end tell
         end tell
      end tell
   end tell
end tell

FWIW, I built this script using Script Debugger’s dictionary explorer. To do this I opened the System Events dictionary, selected processes, found the Safari process (I had to click Show More a few times). Double clicking the Safari process opened it full in the window. I then clicked:
Menu bars> menu bar 1 > menu bar items>menu bar item file>menu items
(this would be much easier using UI Browser!)

I find it’s more reliable to use the names than the index, but both work.

You may need to add delays before the commands, but I didn’t need to.

I’m still a bit confused… I think I went to the right dictionary explorer. See attached. but were do I click on menu bars? thank you

The UI commands are in the System Events dictionary, under the process for each app. Not in the app’s own dictionary. See if this QuickTime helps:

Thank you so much for the video. I’ve been trying to find this for a long time.

one more question: in UI browser i can click on the element and it highlights the element on the actual application. Does script debugger do this? I have an app that has long nested elements and ti would be very helpful if script debugger can highlight as I navigate the element tree. thank you

No. Script Debugger doesn’t do that. I think Apple had a tool that helped with that but I don’t know if it’s still supported.

1 Like

Accessibility Inspector is the apple tool. If you have x-tools installed, it’s already on your Mac.

It’s not as good or appleScript savvy as UI Browser, but it was useful (I haven’t used it in years, since I have UI Browser, but I’ll probably start using it again).

Ed. I didn’t know Script Debugger had this functionality and wouldn’t have figured out its operation without your video. Many thanks.

I did encounter three possible issues which I might mention for other forum members who view your video:

  • After I selected the “Paste Tell” icon, the script format differed from that shown in the video. To change this, the Script Debugger Editor preference that is entitled “Paste Object References as nested Tell blocks” has to be enabled.

  • I don’t have BBEdit, so I tested with TextEdit instead, and placing the activate command where shown in your video doesn’t work for me and returned the error message "System Events got an error: Can’t get process “TextEdit”. Instead, I placed a separate TextEdit tell statement with the activate command at the very-top of the script.

  • The procedure shown in your video doesn’t appear to work for Script Debugger. After selecting “Menu Bar 1” every sub-item was stuck with the notation counting.


Script Debugger 8.03 - macOS Monterey

I can confirm that, with the new 8.0.4 version, the third issue mentioned by @peavine occurs under Monterey on Intel. This is what appears:

Screen Shot 2022-04-29 at 2.41.49 PM