답변:
면책 조항 : 현재로서는 실제로 확인할 수는 없지만 나중에 설명하겠습니다.
와이파이를 켜고 끄는이 스크립트는 여기 에서 가져옵니다 :
try
set makiaeawirelessstatus to do shell script "networksetup -getairportpower en1"
on error
display dialog "The script did not work as intended, please check the networksetup command (in terminal) works on your system. It has been tested on mac os 10.7 (Build 11A459e). Other versions of mac os may not have this command available. Please open the applescript in applescript editor for more details." buttons {"kthxbai"}
end try
if makiaeawirelessstatus is "Wi-Fi Power (en1): On" then
do shell script "networksetup -setairportpower en1 off"
else if makiaeawirelessstatus is "Wi-Fi Power (en1): Off" then
do shell script "networksetup -setairportpower en1 on"
else
display dialog "The script did not work as intended, please check your wireless connection is specified correctly. The default in this script is en1 (please open the applescript in applescript editor for more details)" buttons {"kthxbai"}
end if
인수를 허용하도록 편집해야합니다 (그렇지만 자바 스크립트와 같은 것으로 나타났습니다)
그런 다음 스크립트를 정확하게 실행하려면 LaunchAgent 또는 cron 과 같은 것을 사용하십시오 . 용서하기 때문에 LaunchAgent를 선호합니다.
tell application "System Events" to tell process "SystemUIServer"
click (first menu bar item whose value of attribute "AXDescription" contains "Wi-Fi") of menu bar 1
try
click menu item 2 of menu of (first menu bar item whose value of attribute "AXDescription" contains "Wi-Fi") of menu bar 1
end try
end tell