17

I'm trying to press a button in TeamSpeak using applescript, here is my code:

tell application "TeamSpeak 3 Client" to activate
tell application "System Events"
    tell process "TeamSpeak 3"
        click menu item "Connect" of menu "Connections" of menu bar 1
        delay 2
        click button "Connect"
    end tell
end tell

and here is an image of me hovering over the button in accessibility inspector

Accessibility Inspector inspecting a push button

All I want to be able to do is figure out how to push my button using the information given to me in Accessibility Inspector, but with my code I get the error "System Events got an error: Can’t get button "Connect" of process "TeamSpeak 3"." Here is a screenshot of the window the button is directly inside:

enter image description here

1
  • 1
    There is UI Browser tool which allow to figure our the GUI hierarchy, so it's easier to track the buttons. See related SE post.
    – kenorb
    May 5, 2015 at 22:49

1 Answer 1

13

You also need to specify the parent objects.

activate application "TeamSpeak 3 Client"
tell application "System Events" to tell process "TeamSpeak 3"
    click menu item "Connect" of menu "Connections" of menu bar 1
    click button "Connect" of window 1 of window 1
end tell
1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – bmike
    Dec 6, 2018 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .