I'm trying to open the "Profiles" section of the Terminal settings (image).
Here is my script:
tell application "Terminal"
activate
delay 1
tell application "System Events"
keystroke "," using command down
delay 1
tell process "Terminal"
click menu item "Profils" of menu "Terminal" of menu bar item "Terminal" of menu bar 1
end tell
end tell
end tell
But the script only opens the settings window, and not the section I want.
Once the Terminal preferences are open, try this:
tell application "Terminal"
tell application "System Events" to tell process "Terminal"
set w to window 1
set bp to button "Profiles" of toolbar 1 of w
perform action "AXPress" of bp
end tell
end tell
You may have to change the button string to 'Profils' though.
How I got there. Note, each of the commands below will return a bunch of items. If you look through those items, you can likely figure out the next item to get the elements of.
set w to window 1
UI elements of w
--> toolbar 1 of window "General"
UI elements of toolbar 1 of w
--> button "Profiles" of toolbar 1 of window "General"
Also, you can use the click
command
click at {80, 80}
--> button "Profiles" of toolbar 1 of window "General" of application process "Terminal" of application "System Events"