如何以编程方式打开和关闭蓝牙,WiFi和声音在OSX

问题描述:

如何开启和关闭WiFi和蓝牙连接,更改OSX的声音和亮度级别?

How can I turn on and off the wifi and bluetooth connections, change the sound and brightness levels on OSX?

只需执行正确的命令:-)你甚至可以使用AppleScript。

Simply execute the right commands :-) You could probably even use AppleScript.


  • Wifi: ifconfig en1 off networksetup -setairportpower off li>
  • 蓝牙:您可能需要 http://www.frederikseiffert.de/blueutil/

  • 亮度:我为您找到此c实用程序: http://mattdanger.net/2008/12/adjust-mac-os-x-display-brightness-from-the-terminal/

  • Wifi: ifconfig en1 off or networksetup -setairportpower off
  • Bluetooth: You'll probably need http://www.frederikseiffert.de/blueutil/
  • Brightness: I found this c utility for you: http://mattdanger.net/2008/12/adjust-mac-os-x-display-brightness-from-the-terminal/

这可能是没有 exec()调用,但是这样更容易。

It's probably all possible without exec() calls, but it's easier this way.