Block app (incoming connection) on firewall by applescript

Joined
Dec 17, 2018
Messages
1
Reaction score
0
Hello,

I have a script like below:


Code:
tell application "System Preferences" 
    activate   
    set current pane to pane "com.apple.preference.security" 
end tell
tell application "System Events"
    tell process "System Preferences"       
        click menu item "Security & Privacy" of menu "View" of menu bar 1  
        if title of button 4 of window 1 is "Click the lock to make changes." then            
            click button "Click the lock to make changes." of window 1
        end if   
        try      
            click button "Turn On Firewall" of tab group 1 of window "Security & Privacy"      
        end try   
        set visible to false   
    end tell    
end tell
tell application "System Preferences" to quit

I have two questions as
- when I run it, showed rwarning result like below. Question 1 is what is wrong this code? and How to correct it. I use serria os
error "System Events got an error: Script Editor is not allowed assistive access." number -1719 from menu bar 1 of process "System Preferences"

Question 2 is I wanna add block incoming connection of specific app to firewall. How can I write it on code like above?
 
Joined
Jan 25, 2017
Messages
1,266
Reaction score
100
You need to open System Preferences> Privacy> Accessibility click the + and add Script Editor.
 

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