Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.5: Enable and disable the firewall via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Enable and disable the firewall via AppleScript
Authored by: raoulteeuwen on Jun 07, '09 06:25:09AM

Thanks. For people with Dutch OSX language and without Growl, your script is:

-- Firewall on script
--
-- Growl support - remove next line if you don't use Growl
-- Make sure support for assistive devices is active
tell application "System Events"
if UI elements enabled is false then
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.universalaccess"
-- OK or cancel. If use cancels the script exits anyway
display dialog "This script requires access for assistive sevices be enabled." & return & return & "To continue, click the OK button and enter an administrative password in the security dialog." with icon 1
end tell
-- User pressed OK
set UI elements enabled to true
if UI elements enabled is false then
-- remove next line if you don't use Growl
return "Failed to set"
end if
delay 1 -- delay for user to see change
end if
end tell
-- Do firewall action
tell application "System Preferences"
activate
tell application "System Events"
tell process "Systeemvoorkeuren"
click menu item "Toon alle voorkeuren" of menu 1 of menu bar item "Weergave" of menu bar 1
click button "Beveiliging" of scroll area 1 of window "Systeemvoorkeuren"
repeat until exists window "Beveiliging"
delay 0.2
end repeat
click radio button "Firewall" of tab group 1 of window "Beveiliging"
-- uncomment the next line, and comment the one below it, to create the 'off' version of this script
-- click radio button "Sta alle inkomende verbindingen toe" of radio group 1 of tab group 1 of window "Beveiliging"
click radio button "Sta alleen essentiƫle voorzieningen toe" of radio group 1 of tab group 1 of window "Beveiliging"
-- remove next line if you don't use Growl
-- my growlnote("General Notification", "Allow only essential services")
end tell
end tell
delay 2 -- Stay just long enough to see
quit -- Quit system preferences after use
end tell



[ Reply to This | # ]