Folgen Sie dem Video unten, um zu sehen, wie Sie unsere Website als Icon auf Ihrem Homescreen erstellen.
Anmerkung: This feature may not be available in some browsers.
tell application "System Events" to tell the front menu bar of process "SystemUIServer"
try
click bt_menu
tell the second menu item of the front menu of bt_menu to if title contains "Bluetooth" then
click
else
error
end if
on error
repeat with x in menu bar items
click x
try
if the title of the first menu item of the front menu of x starts with "Bluetooth" then exit repeat
end try
end repeat
set bt_menu to x
try
tell the second menu item of the front menu of bt_menu to if title contains "Bluetooth" then
click
else
error
end if
on error
click bt_menu
display alert "Bluetooth Menu Extra not found."
end try
end try
end tell
--
--
--
tell application "iSync"
activate
synchronize
delay 80
quit
end tell
--
--
--
tell application "System Events" to tell the front menu bar of process "SystemUIServer"
try
click bt_menu
tell the second menu item of the front menu of bt_menu to if title contains "Bluetooth" then
click
else
error
end if
on error
repeat with x in menu bar items
click x
try
if the title of the first menu item of the front menu of x starts with "Bluetooth" then exit repeat
end try
end repeat
set bt_menu to x
try
tell the second menu item of the front menu of bt_menu to if title contains "Bluetooth" then
click
else
error
end if
on error
click bt_menu
display alert "Bluetooth Menu Extra not found."
end try
end try
end tell
Vorbildlich, mein Herr.macwoif schrieb:bidde sehr...
Das "delay" muss gegebenenfalls angepasst werden.
tell application "System Events"
tell process "ControlCenter"
set _theBluetoothToggle to menu bar item "Bluetooth" of menu bar 1
click _theBluetoothToggle
--delay 0.2
set _theBluetoothState to checkbox "Bluetooth" of group 1 of window "Kontrollzentrum"
click _theBluetoothState
end tell
key code 53
end tell
tell application "System Events"
tell process "ControlCenter"
set _theControlcenter to menu bar item "Kontrollzentrum" of menu bar 1
click _theControlcenter
--delay 0.2
set _theBluetoothState to checkbox "Bluetooth" of group 1 of group 1 of window "Kontrollzentrum"
click _theBluetoothState
end tell
key code 53
end tell
Meiner Meinung nach auch. Ein Script könnte so aussehen:Hallo,
meiner Meinung nach ist blueutil nach wie vor der beste Weg, um Bluetooth per Skript zu de/aktivieren.
https://github.com/toy/blueutil
...
set blueutilpath to quoted form of "/path/to/blueutil"
if last word of (do shell script blueutilpath & " status") = "on" then
do shell script blueutilpath & " off"
else
do shell script blueutilpath & " on"
end if