I tried many methods to toggle internet sharing with Alfred but its not working! Its driving me crazy!

Can anyone please help me with an AppleScript which I can paste in Alfred and assign a hot key to perform this function?

ps: I don't have much knowledge with scripts. Ill just copy paste the script from here if I get an answer from someone!


You could try this (tested on OSX 10.9.5 but it may depends on the version of you OS) :

tell application "System Preferences"
-- display system preferences window
-- wait to see the window
delay 1.5
-- try again
-- Open sharing tab (or pane)
set current pane to pane "com.apple.preferences.sharing"
-- we want to see it
delay 1.5

tell application "System Events"
    tell process "System Preferences"

        -- click the checkbox to enable internet sharing
        tell window 1 to click checkbox 1 of row 8 of table 1 of scroll area 1 of group 1
    end tell
end tell
-- wait to see the result
delay 1.5
--quit -- we can quit system preferences
end tell
  • Not working! Mine is Sierra 10.12.1! – manoj chandra Oct 29 '16 at 9:27
  • Does the system preferences window appear ? – boissonnfive Nov 3 '16 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .