概要
ほとんど @ishkawa さんのこの記事の通りだが、bluetoothテザリングがどうにも遅く、Wi-Fiテザリングに変更したときのメモ。
変更点
touch ~/bin/connectBluetoothTethering
chmod +x ~/bin/connectBluetoothTethering
↓
touch ~/bin/connectWifiTethering
chmod +x ~/bin/connectWifiTethering
-
~/bin/connectWifiTethering
の内容
#!/usr/bin/osascript
set SSID to "Your iPhone Name"
-- 他の既知のネットワークがある場合それに繋がるのを待つ
delay 3
tell application "System Events" to tell process "SystemUIServer"
set var1 to value of attribute "AXDescription" of menu bar items of menu bar 1
if (var1 contains "Wi-Fi, No Signal.") then
tell application "System Events"
tell process "SystemUIServer"
set sMenu to (menu bar item 1 of menu bar 1 whose description contains "Wi-Fi")
tell sMenu
click
-- パーソナルホットスポットが表示されるのに時間がかかるので待つ
delay 3
tell (menu item SSID of menu 1)
click
end tell
end tell
end tell
end tell
end if
end tell
日本語環境の場合は "Wi-Fi, No Signal."
を 調査中
、 "Wi-Fi"
を 調査中
に変更。
-
.wakeup
の内容
~/bin/connecBluetoothTethering
↓
~/bin/connectWifiTethering
参考
https://blog.ishkawa.org/2018/11/09/1541697110/
https://discussionsjapan.apple.com/thread/110200637
https://apple.stackexchange.com/questions/184899/applescript-to-identify-the-current-status-of-network-connection
https://stackoverflow.com/questions/43780648/applescript-if-contain
https://alvinalexander.com/apple/applescript-for-loop-while-loop-examples