press connect
is there a one click solution for this?
t tried this: (from Claude)
– AppleScript für macOS Ventura/Sonoma und neuer
– Speichere als .scpt oder exportiere als App
tell application "System Settings"
activate
delay 1
reveal pane id "com.apple.BluetoothSettings"
end tell
delay 3
tell application "System Events"
tell process "System Settings"
try
-- Suche nach JBL Quantum910 in der Geräteliste
set deviceFound to false
repeat with i from 1 to 20
try
-- Verschiedene UI-Strukturen probieren
set deviceButtons to buttons whose name contains "JBL Quantum910"
if (count of deviceButtons) > 0 then
set targetButton to item 1 of deviceButtons
click targetButton
delay 1
-- Nach Connect/Verbinden Button suchen
try
click button "Connect" of window 1
set deviceFound to true
exit repeat
on error
try
click button "Verbinden" of window 1
set deviceFound to true
exit repeat
end try
end try
end if
end try
delay 0.5
end repeat
if not deviceFound then
-- Alternative: Direkt über Menü versuchen
tell application "System Events"
tell process "Control Center"
-- Control Center Bluetooth-Icon anklicken
try
click menu bar item 1 of menu bar 1
delay 1
click button "Bluetooth" of window 1
delay 1
click button "JBL Quantum910" of window 1
end try
end tell
end tell
end if
on error errMsg
display dialog "Fehler beim Verbinden: " & errMsg
end try
end tell
end tell
-- System Settings wieder schließen
tell application "System Settings"
quit
end tell
It looks like you’re running MacOS under German language settings correct? “System Settings”, “Control Center” and other strings will have to match the appropriate application names under your current language.
First i wanna thank both of you for your answers which both sounded promising.
I am a totally noob in scripting…so i kept asking Chatgpt and it recommended using blueutil.
i finally was successful with this script:
set blueutilPath to ""
try
set blueutilPath to do shell script "which blueutil"
on error
set blueutilPath to ""
end try
-- 2) fallback: bekannte Homebrew-Pfadoptionen
if blueutilPath is "" then
if (do shell script "test -x /opt/homebrew/bin/blueutil && echo 1 || echo 0") is "1" then
set blueutilPath to "/opt/homebrew/bin/blueutil"
else if (do shell script "test -x /usr/local/bin/blueutil && echo 1 || echo 0") is "1" then
set blueutilPath to "/usr/local/bin/blueutil"
end if
end if
-- 3) wenn nicht gefunden -> Hinweis und Abbruch
if blueutilPath is "" then
display dialog "blueutil wurde nicht gefunden. Installiere mit:
brew install blueutil" buttons {"OK"} default button "OK"
return
end if
do shell script (quoted form of blueutilPath & " --connect " & quoted form of "JBL Quantum910")
I think the UI stuff depends on your system version. I’m on 12.4 and investigating the UI you have to access the pop of menu of the table of the outline view of the window.
You have to access the rows of the table view.
Check its first text field for the name.
2nd text field has the connection status
The select the appropriate row.
Then perform the AXShowMenu of the table and then select the connect menu item