How many keys to enable or disable Internet sharing for Mac OS

Source: Internet
Author: User


MacBook provides an easy-to-use Internet sharing feature that can be used as a lightweight home wireless route. Your cell phone, touch, and pad devices can all use a Wi-Fi network to connect to the Internet.
The specific settings are very simple. system preference settings-> sharing-> Inernet sharing-> Start several steps, but it is still very troublesome to click so many times each time, we can use the Apple Script and QS artifacts to make simple operations easier.

Open the applescript editor and typeCode(For reference ):

The following code is based on indentation.

Tell application "System Preferences"
Activate
End tell

Tell application "System Events"
Tell process "System Preferences"
Click menu item "share" of menu "display" of menu bar 1
Delay 2
Tell window "sharing"
Click checkbox 1 of row 11 of table 1 of scroll area 1 of Group 1
Delay 1
If (exists Sheet 1) then
If (exists button "Open airport" of Sheet 1) then
Click button "Open airport" of Sheet 1
Delay 1
End if
Click button "START" of Sheet 1
Else
Do shell script "/usr/sbin/networksetup-setairportpower EN1 off"
Delay 1
End if
End tell
End tell
End tell

Ignoring application responses
Tell application "System Preferences" to quit
End ignoring

File-> storage, save as a script file, such as ws. scpt, and then run it. The effect is displayed.
Then call out Qs. If you are a Mac user and do not know QS, use Google Baidu. Find ws. scpt in the path in QS and run it. After one operation, you can directly operate on the keyboard. Call out QS and type ws. You can find ws. scpt and press Enter.

Now, call out Qs. Type WS and press enter to enable or disable Internet sharing automatically.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.