0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macOSでスリープ解除されたら自動的にWi-Fiテザリング に繋がるようにする

Last updated at Posted at 2019-04-23

概要

ほとんど @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

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?