Script to turn wifi on/off

Hello,
Can someone provide a script that will simply turn on or off wifi as if using doing this manually from the menu bar?
THx!

Thanks for this. I did google and find a few others before I posted but none of them worked.
This one did work http://www.makiaea.org/post/5993587804 after I changed "en0" to "en1"
THis is working in my MBP:
-- 20110529 www.makiaea.org ref: 20110529wlx-wirelessonoff.applescript
-- wlx toggles wifi (airport wireless) power on and off
-- Tested using macbook air 3,1 , mac os 10.7 (Build 11A459e), quicksilver ß59 (3842)
-- if you are not using quicksilver to run the script, you may need to compile the script first (using applescript editor) and save as an .scpt script or as an app if you want to double–click with the mouse on an icon to run it.
-- note this assumes your wireless ethernet interface is en1
-- get the correct interface from the menu Apple|About This Mac|Network|Wi-Fi or from terminal using ifconfig -a
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
THx

Similar Messages

  • Portege Z930: Loss of Fn keys after Win 8 upgrade - cannot turn WiFi on/off

    After many months biding my time I have just embarked upon upgrading my Portege Z930-11G to Windows 8 Pro.
    Largely this has gone to plan with the exception that after running the Toshiba Upgrade Assistant I've lost the Fn key display and about half the keys no longer seem to function at all.
    The only key I ever used routinely is the Fn+F8 option to turn WiFi on/off.
    So now I cannot enable the WiFi on the machine.
    There must, surely, be a mean to do this but I can't find it. Does anyone have a suggestion? I'm OK for now as I have a wired LAN in the house but once I get out on the road I'm going to struggle without WiFi.
    Before running the upgrade assistant the Fn key brought the key display up across the top of the screen and I surely wish I'd turned WiFi on at that point.
    The Fn key utility offers very little control of the Fn keys. It does not offer the ability to do anything other than disable five on screen notifications for keyboard backlight, power plan, touch pad, cursor overlay and numeric overlay.
    All help gratefully received.
    Andrew

    > So now I cannot enable the WiFi on the machine.
    First of all you can enable and disable the WiFi using function key but you can also enable the WLan in Windows 8 settings
    Win key + C -> Settings -> Change PC settings -> Wireless
    Now you can use the wireless devices slider to enable or disable the WLan.
    But to get the FN key working you have to install the +Toshiba Function Key Utility+ for Win 8 and +Toshiba System Driver+ for Win 8

  • Apple script to turn AirPort on/off?

    Is there a way to use Apple script to turn an AirPort Extreme on and off?

    I haven't used these tools so I don't know for sure, but doesn't Tiger's parental controls (in the Accounts preference pane) allow you to enable/disable network access by account? Would that work to solve your problem?
    EDIT: OK, by starting a new thread I guess you got the same response that I posted for your previous thread. For those interested, this is a continuation of the thread kevin macky, "Account with and without airport internet access", 08:07am Oct 11, 2005 CDT.
    If you are interested in trying to automate this, I suggest that you post your question in these areas:
    Mac OS X > Mac OS X Technologies > AppleScript
    Mac OS X > Mac OS X v10.4 Tiger > Automator

  • A1 ICS : Stuck on Turning Wifi On/Off.

    It have A1107 ICS on there.
    With Airplane mode, with wifi on.  Screen goes to sleep, about 30min wake it up no wifi. 
    Toggleing Airplane mode doesn't do much.  go under wifi and there be message Truning Wifi On or Off and can't do nothing.
    Killed all tasks, still no change.    Only way is to reboot.
    ==
    Tried with Airplane mode off, seem more reliable but just never know if I have to reboot to connect or not when ever I pick it up.

    I get this about half the time too. It is rather frustrating. Thankfully ICS boots much faster than GB did.
    I think the WiFi lockup occurs when the tablet goes into deep sleep. I turn my WiFi off at night before charging. About half the time I have to reboot in the morning, the other half, WiFi turns on just fine.
    When out and about (not having turned it off manually), it seems to be random. Sometimes it connects fine, other times it is locked up. I suspect that whether or not WiFi is able to restart depends on how long it has been out of contact with an Access Point. Perhaps it is some background task waking up, trying to communicate, can't, and then doesn't gracefully go away, locking the network service. But these are just guesses.
    There has been absolutely no indication from Lenovo that any operating system development is continuing for the A1. It is pretty clear from their product releases that they've moved on. So, I think our best hope of improvments are from the user community.

  • Turning wifi on/off.

    Last night I set up a wireless router in my home. How do I set up my iPhone to turn off wifi when I'm not there?

    Misanthropik wrote:
    But my phone is still receiving (and possibly sending) data from those possibly insecure networks. Otherwise I'd not see them listed in my wifi settings. I don't want my phone to communicate with networks other than my own - even if that communication is minimal.
    No it is not.  Those networks broadcast their SSID (their network identity), and your iPhone detects those signals.  It literally is no different than a cell tower constantly tranmitting its id and presence, so those devices looking for it are aware it exists.  It sends nothing at all back to those detected wifi nodes, unless you actively go through the steps in settings to join those networks, and all it recievies is the equivalent of a "I'm here".
    There is absolutely no security issue with merely leaving your wifi radio ON for convenience.

  • My iPad says I am connected to wifi, but the internet won't work. I have tried turning wifi on/off and also resetting the network settings. Help!

    The past two days my iPad mini has not been working with the wifi at my house. There is also and iPhone 5 and an iPad air that are working perfectly fine. I don't know what to do

    Try forgetting the network, reboot your iPad and then try joining the network again.
    Settings>WiFi>Your network name>Forget this network. Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.
    Go back to Settings>WiFi>Your network name>Enter your password>Tap Join.
    If that doesn't work, reset network settings. Settings>General>Reset>Reset Network Settings. Reboot the iPad again. Go back to Settings>WiFi>Your network name>Enter your password>Tap join.

  • My dad gave me an iPhone 3G to use as an ipod touch but it's not picking up wifi. ive tried everything to like resetting the network settings turning wi fi off and on mutable times, turned the phone off on and on. What do i do?

    My dad gave me an iPhone 3G to use as an ipod touch but it's not picking up wifi. ive tried everything to like reseting the network settings turning wi fi off and on mutable times, turned the phone off on and on. What do i do?
    the iphone never really picked up wi fi when it was used as a phone and it didnt really matter because he had unlimited internet but it still wont go on wi fi. does any one know why it is doing this?
    The iphone works fine other wise i just really want it to go on wi fi. We just got new wi fi too and all of our other apple products go on the wi fi just fine. I dont know if its because its newer or what but my brothers 1st gen ipod goes on wi fi just fine.
    The iphone is updated to the latest ios too
    WHAT SHOULD I DO!!!!!!!!!!!???????

    This might help
    http://support.apple.com/kb/ht3406

  • Safari and firefox 'cannot find the server' for every other page that i navigate to, unless I turn Wifi off and on. How do I fix this?

    Safari and firefox 'cannot find the server' for every other page that i navigate to, unless I turn Wifi off and on. Once i reconnect to the network, the page loads, but after loading a few more pages, the same thing happens all over again.
    This happens each and every time, on different Wifi networks, in different locations.  On the other hand, I don't ever encounter this problem when I tether my laptop to my mobile phone's 3g/2g network using Personal Hotspot. How do I fix this?

    Try this DNS server ...
    Open System Preferences > Network > Advanced > DNS
    Click + and type:
    208.67.222.222
    Click + again and do the same.
    208.67.220.220
    Click OK.
    Quit and relaunch both your browsers to test.
    If that doesn't help, try here >  iOS: Troubleshooting Wi-Fi networks and connections
    And here >  Wi-Fi: How to troubleshoot Wi-Fi connectivity

  • I was mid facetime call and my phone turned off and wouldnt turn on until i plugged it in. then the date was wrong,it said no service, and wont let me turn wifi on. also it wont stay on for more than a few minutes at a time

    i was mid facetime call and my phone turned off and wouldnt turn on until i plugged it in. then the date was wrong,it said no service, and wont let me turn wifi on. also it wont stay on for more than a few minutes at a time. Help?

    Sounds like a hardware failure.
    Make an appointment at the genius bar and take it in for them to look at. It will probably need to be replaced.

  • Although I turned off WiFi, set as 'require admin password to turn on and off wifi, when I turn on my MacBook Pro, retina latest model, just got for a month, it turns on wifi automatically, is this a back door or virus or security hole? Thank you

    I have my all networks at 'Off' status in the system panel, never use Bluetooth either, also in the top status bar, and set as 'require admin password to turn on and off WiFi', but when I turn on my MacBookPro 15" retina newest model only one month old, it goes on to WiFi automatically by itself.
    Is this a back door? Security hole?
    The other day, I was taking a break for five minutes, when I came back, the Microsoft outlook is open for setting up an account, I never use outlook, it is there only because it comes with the office package. Also, iTunes was playing music, I don't use iTunes when I'm working. Both were not on before I left for the break.
    What is the problem?

    I have my all networks at 'Off' status in the system panel, never use Bluetooth either, also in the top status bar, and set as 'require admin password to turn on and off WiFi', but when I turn on my MacBookPro 15" retina newest model only one month old, it goes on to WiFi automatically by itself.
    Is this a back door? Security hole?
    The other day, I was taking a break for five minutes, when I came back, the Microsoft outlook is open for setting up an account, I never use outlook, it is there only because it comes with the office package. Also, iTunes was playing music, I don't use iTunes when I'm working. Both were not on before I left for the break.
    What is the problem?

  • I lost the ability to use wifi after the 8.02 update.  Is there a way to fix this?  I've already tried resetting network.  Turned the phone off and on. Nothing is working and now I have to run on just data.

    I lost the ability to use wifi after the 8.02 update.  Is there a way to fix this?  I've already tried resetting network.  Turned the phone off and on. Nothing is working and now I have to run on just data.

        csdwarf,
    So sorry to hear about the trouble with Wi-Fi! Let's get that working the way it should. Could you provide us some more details regarding where this breakdown occurs? Are you having trouble with turning Wi-Fi on or connecting to your Wi-Fi? Are other devices connecting to your Wi-Fi without issue?
    BrianP_VZW
    Follow Us on Twitter @VZWSupport

  • Mail on my iPhone and iPad no longer works on wifi. If I turn wifi off I can connect over the cellular network. I have tried deleting my AOL account and setting it up again as a new account but I still have the same problem.

    Mail on my iPad and iPhone has stopped connecting using wifi. If I turn wifi off I can connect using cellular. I have tried deleting my AOL account and setting it up again as a new account but that hasn't helped.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Using a POP account with multiple devices
    http://support.apple.com/kb/ht3228
    iOS: Adding an email account
    http://support.apple.com/kb/HT4810
    iOS: Setting up an Outlook.com, Hotmail, Live, or MSN email account
    http://support.apple.com/kb/ht1694
    iPhone, iPad, iPod touch: Microsoft Outlook 2003, Outlook 2007, Outlook 2010 may not display contacts and calendars after sync
    http://support.apple.com/kb/TS1944
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say “Cannot Connect to Server”?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    Gmail Account Will Not Connect to Gmail Server
    http://support.apple.com/kb/ts3058
    How to Delete Email on the iPad
    http://ipad.about.com/od/iPad_Guide/ss/How-To-Delete-Email-On-The-Ipad.htm
    How to Mass Delete Emails from iPhone and iPad Inbox (with video)
    http://suiteminute.com/how-to-mass-delete-emails-from-iphone-and-ipad-inbox/
    How to add, send and open iPad email attachments
    http://www.iskysoft.com/apple-ipad/ipad-email-attachments.html
    How to Sync Contacts with Your iPad Using iTunes
    http://www.dummies.com/how-to/content/how-to-sync-contacts-with-your-ipad-using- itunes.html
    Importing a Contact List CSV to the iPad
    http://techchannel.radioshack.com/importing-contact-list-csv-ipad-2235.html
    iOS: ‘Mailbox Locked’, account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    iCloud: Create a group and add contacts to it
    http://support.apple.com/kb/PH2667
    eMail Groups - You can use a third party app that many users recommend.
    MailShot -  https://itunes.apple.com/us/app/mailshot-pro-group-email-done/id445996226?mt=8
    Group Email -  https://itunes.apple.com/us/app/mailshot-pro-group-email-done/id445996226?mt=8
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Configuration problems with IMAP e-mail on iOS with a non-standard SSL port.
    http://colinrobbins.me/2013/02/09/configuration-problems-with-imap-e-mail-on-ios -with-a-non-standard-ssl-port/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
    How to delete an email account on your iPad
    http://www.shoppepro.com/support/knowledgebase/228/How-to-delete-an-email-accoun t-on-your-iPad.html
     Cheers, Tom 

  • Why can't I access the internet and e-mail on wifi in my house, but, I can if I turn wifi off?

    Why can't I access the internet and e-mail on wifi in my house, but, I can if I turn wifi off?

    Hello srpeters5,
    Thank you for the details of the issue you are experiencing with Wi-Fi on your iPhone.  You have taken some really good steps to troubleshoot this issue already.  I found an article that includes a few additional steps you can try.  You can skip any steps you have already taken.
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/ts1398
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • I turned my iMessages off and now it won't turn back on and asks for mobile data or wifi to be on but my mobile data works fine! How do I get iMessages to turn on again?

    I Turned my iMessages off and now it won't turn on again without saying that wifi or mobile data must be turned on, however my mobile data works fine. How do I get iMessages to turn on again?

    I had a similar issue with my phone.....it just shut off and wouldn't come back on even thought it was charged.  My daughter toggled the mute switch several times and then she pressed and held down the home and lock buttons.  It worked......would be worth a shot.

  • Someone has hacked my things, how do I turn wifi off, and when will it be safe to go back on?

    Someone has hacked my things, how do I turn wifi off, and when will it be safe to go back on? Also, do I need to reset everything? I have already changed passwords, covered my webcam, etc. Will they still have access to my computer?

    Could you explain what you mean by 'Someone has hacked my things'?
    What Mac do you have, with what version of OS X?
    What security do you have on your wi-fi?

Maybe you are looking for

  • Help!- problems with Adobe reader v9 ifilter and sqlserver2005

    Hello, I am trying to implement search of pdf in binary column in sqlserver2005 using Adobe ifilter. I installed full version of Adobe reader v9 which has its own Ifilter on my server (runs on 32bit) I have done the following based on what i read on

  • I cannot locate my itunes files in imovie

    Hi, I am trying to add some music to a home video i shot and when I select the desired song from my itunes, I receive the following error message. The song "xxxx xxxx" could not be used because the original file could not be located. I can easily acc

  • After editing i can hear effects over tracks but not the tracks themselves?

    after editing and saving as a garage band file i can hear the first two tracks in their entirety, but not the other 8 (except for the reverb over them). if i kill the reverb over these tracks then only silence remains. input, output and monitoring op

  • Group select/delete files

    Is there a way to select more than one file for deletion? to alter restrictions? etc.

  • Reinitialisation d'i phone et perte d'application

    bonjour, suite à une connexion de mon iphone avec mon ordi j'ai été obligé de re-initialiser mon telephone et j'ai perdu toutes les applications que je venias d'acheter sur apple store et que je n'avais pas encore synchronisées. comment puis je récup