1

ProxyToggle AppleScript:

set socksStatus to do shell script "networksetup -getsocksfirewallproxy Wi-fi | grep Enabled"

if (offset of "Yes" in socksStatus) = 0 then do shell script "networksetup -setsocksfirewallproxystate Wi-fi On" display notification "Proxy Enabled !" else do shell script "networksetup -setsocksfirewallproxystate Wi-fi Off" display notification "Socks disabled"

end if

How to add a button to the toolbar that invokes above AppleScript? Menu Item = View, Customize Toolbar.

enter image description here

gatorback
  • 3,031
  • 8
  • 40
  • 57
  • 1
    I'd just use an Automator Service/Quick Action and assign it a keyboard shortcut, e.g.: ⌥⌘P – user3439894 Aug 21 '20 at 12:30
  • @user3439894 If you have a link that provides instructions, please to add link. I am sure the community would like to see an example of such an option – gatorback Aug 21 '20 at 19:52
  • 1
    gatorback, This has been covered ad nauseam on this site and the Internet and a Google search should provide many hits. Basically... Create an Automator workflow of type Service/Quick Action with setting Service/Workflow receives no input in Safari adding a Run AppleScript action and your code. Save it and then give it a keyboard shortcut in: System Preferences > Keyboard > Shortcuts > Services -- ⌥⌘P should work. -- Then provide appropriate permissions in System Preferences > Security & Privacy > Privacy as needed if/when prompted. – user3439894 Aug 21 '20 at 21:21

0 Answers0