Hi everyone
Do you know how to disable the wifi automatically when shutting down the computer (10.8.2)?
I have been searching the internet but all I could find was people having problems with this.
Thanks a lot
![]()
do shell script "networksetup -setairportpower en0 Off"
delay 1
tell application "Finder"
shut down
end tell
Code:do shell script "networksetup -setairportpower en0 Off" delay 1 tell application "Finder" shut down end tell
[I]do shell script "networksetup -setairportpower en0 Off"[/I]
Adding that to login items would power off the wifi at login and not shutdown....
Then save the script as an application and paste it in the Login Items.
Is that right?
Thanks!
![]()
A. I'm pretty sure it needs to be en1 rather than en0, though it may depend on the Mac model. I.e. en1 is wifi on Macs with both ethernet and wifi. I don't know what a MacBook Air has for its wifi interface name, since it doesn't ship with ethernet by default.
B. If just the do shell script line is placed in an AppleScript application, then that app can be added to a user's Login Items, and will run at login. I mention this because it's easier to add things to run at login than it is to add things to run at shutdown or logout.
Thanks that has solved my problem.
It wasn't what I was thinking of originally but it did the trick.
I just needed indeed to change the en0 into an en1 (I'm on a MacBookPro).
If anybody wants to add a code for a confirmation of shutdown question to be added to the shutdown+wifiOFF app, it may help someone in the future.
Thanks again!
![]()
display dialog "Are you sure you want to shut down?"
do shell script "networksetup -setairportpower en1 Off"
delay 1
tell application "Finder"
shut down
end tell