Skip to content

Instantly share code, notes, and snippets.

@yaqinking
Created February 14, 2016 08:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaqinking/7b01a17526881da9aa2f to your computer and use it in GitHub Desktop.
Save yaqinking/7b01a17526881da9aa2f to your computer and use it in GitHub Desktop.
重启 Mac 蓝牙来解决 iOS 端 AirDrop 不能发现 Mac 设备
-- 有时候 Mac 的 AirDrop 会在 iOS 端发现不了,当窝发觉这个 bug 可以通过重启 Mac 蓝牙解决的时候,Google 加折腾找到了这个脚本的前半部分,经过修改,直接生成重启蓝牙的大法,解决问题,可喜可贺,可喜可贺(圆润的滚走
-- 如果还是在 iOS 端发现不了,那就关闭 iOS 端的 AirDrop 然后再开启,所谓的重启 iOS 端 AirDrop 大法诞生。
-- 至于 AirDrop 的用途,当然是拿来发 DL 链接 <_<
-- 脚本参考地址:https://apple.stackexchange.com/questions/152333/toggle-bluetooth-applescript-not-working-in-yosemite
property thePane : "com.apple.preferences.bluetooth"
tell application "System Preferences"
activate
set the current pane to pane id thePane
delay 1
end tell
tell application "System Events"
tell process "System Preferences"
try
click button "Turn Bluetooth Off" of window "Bluetooth"
on error
click button "Turn Bluetooth On" of window "Bluetooth"
end try
delay 3 --以防性能不足,导致失败
try
click button "Turn Bluetooth Off" of window "Bluetooth"
on error
click button "Turn Bluetooth On" of window "Bluetooth"
end try
end tell
end tell
quit application "System Preferences"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment