Is there a way to turn Wi-Fi on/off using Spotlight? Is there a way to turn Wi-Fi on/off using Spotlight, or do I always have to use the mouse and click on the Wi-Fi icon in the taskbar?

Spotlight is pretty powerful, and I would love to have an easy way of enabling/disabling the Wi-Fi connection. Is there a built-in way of doing this, or do I need to create a script for this, and then call the script from Spotlight?
Not sure if this is the best method, but there's at least one way to set a keyword to trigger stuff in spotlight, and that is by making an application with Automator. 

Personally I use Alfred for this type of stuff, but it's not overly difficult to do this with Automator.


Open Automator.app 


It should by default ask you what type of file to make, but if it doesn't ⌘ + N 

Choose a type for your document: Application
Start writing: shell
Press ↵ Enter twice
It should now look something like this 
Replace the cat text with: networksetup -setairportpower en0 off
Save ( ⌘ + S  )
Name it: Wifi OFF.app
Duplicate ( ⌘ + ⇧  +  S  )
Rename to: Wifi ON
In the networksetup -setairportpower en0 off text, replace the off with:  on
Save ( ⌘ + S  )


Now if you open spotlight and write wifi, you should see something like this:









If you want to change the icons, here's an article explaining how in detail: http://osxdaily.com/2013/06/04/change-icon-mac/

Short version:


Open the desired image in Preview.app (png works the best) 
Select all ( ⌘ + A  )
Copy ( ⌘ + C  )
Select the Wifi On.app in finder
Go to file info: ( ⌘ + i  )
Click the current icon on the top left
Paste ( ⌘ + V  )

After changing the icons, you might not see them change immediately. You can force spotlight to see the new icons faster by trashing the apps and then undoing it (taking files off the trast).




Links to the icons I used:


Wifi OFF
Wifi ON