zjlovezj 最近的时间轴更新
zjlovezj

zjlovezj

V2EX 第 196955 号会员,加入于 2016-10-18 22:40:24 +08:00
zjlovezj 最近回复了
2020-11-21 21:33:54 +08:00
回复了 wangbingqian521 创建的主题 macOS Big Sur 没法自动切换 AirPods?
应该是 Big Sur 的版本不对,苹果这个系统估计做的很着急,AppleScript 相关的东西每次更新都不太一样
2020-11-19 19:04:31 +08:00
回复了 wangbingqian521 创建的主题 macOS Big Sur 没法自动切换 AirPods?
对了,上面的 AppleScript 的前提条件是要把 Bluetooth 从 Control Center 拖到 menu bar 才行。
2020-11-19 18:59:29 +08:00
回复了 wangbingqian521 创建的主题 macOS Big Sur 没法自动切换 AirPods?
因为自动切换在 Mac 上体验太差了,我现在 Big Sur 不自动连接 AirPods 了。
还是用 AppleScript 来连接 AirPods,因为 Big Sur 以前的 AppleScript 不能用了,最近琢磨了一个新的可用的脚本。
结合 QuickSilver 来做快捷方式,用起来比自动切换体验好多了。
想连 Mac 时,执行 AppleScript 。想连手机时,再执行 AppleScript,断掉 AirPods 和 Mac 的连接后,AirPods 就自动和手机连上了。

手机:iPhone 11 / iOS 14.2
电脑: MacBook Pro 2017 / Big Sur 11.1 beta 20C5048k (2020-11-19 更新)

AppleScript 如下:

global x -- declare x
set x to 0
global y -- declare y
set y to 0

tell application "System Events" to tell process "SystemUIServer"
set bt to menu bar item "Bluetooth" of menu bar 1 of application process "ControlCenter" of application "System Events"
click bt
set xy to position of bt
set x to (item 1 of xy)
set y to (item 2 of xy)
end tell


tell application "System Events"
-- 多屏时参考相对位置;可能会有一点差异
click at {x + 60, y + 115}
end tell
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1010 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 19:09 · PVG 03:09 · LAX 12:09 · JFK 15:09
Developed with CodeLauncher
♥ Do have faith in what you're doing.