How to turn off your Firewall with AppleScript !

Ric

Joined
May 14, 2004
Messages
4,260
Reaction score
5
To run this script you need to have GUI Scripting turned on...

Go to System Preference-->Universal Access

assistive.jpg


and 'tick' "Enable access for Assistive devices"

The scripts will not work without this !!!


There are two scripts below, one will turn off the Firewall, one will turn it on !

They have also been saved as AppleScript Applications so that you can leave them either in your Dock or on your Desktop...

Firewall On Script


tell application "System Preferences"
*****activate
*****set current pane to pane "com.apple.preferences.sharing"
end tell

delay 1

tell application "System Events"
*****tell process "System Preferences"
**********-- GUI Scripting statements:
**********try
***************click radio button "Firewall" of tab group 1 of window "Sharing"
**********end try
**********
**********delay 1
**********try
***************click button "Start" of tab group 1 of window "Sharing"
**********end try
**********
**********delay 1
**********
*****end tell
end tell

tell application "System Preferences" to quit

display dialog "Your Firewall is now on !" giving up after 2


---Ric @ www.mac-help.com


Firewall Off Script


tell application "System Preferences"
*****activate
*****set current pane to pane "com.apple.preferences.sharing"
end tell

delay 1

tell application "System Events"
*****tell process "System Preferences"
**********-- GUI Scripting statements:
**********try
***************click radio button "Firewall" of tab group 1 of window "Sharing"
**********end try
**********
**********delay 1
**********try
***************click button "Stop" of tab group 1 of window "Sharing"
**********end try
**********
**********delay 1
**********
*****end tell
end tell

tell application "System Preferences" to quit

display dialog "Your Firewall is now off !" giving up after 2


---Ric @ www.mac-help.com


regards

Ric
 

Attachments

  • Firewall Scripts.zip
    43 KB · Views: 578

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top