When I try to Miniaturise all windows with the following AppleScript, Automator minimizes all windows, then tells me: "Syntax Error: System Events got an error: Automator is not allowed assistive access" while I already checked Automator in Security & Privacy > Accessibility > Privacy. Saving the Apple script as an app led to a similar issue (screenshots are attached). What is the solution to avoid these errors?
Apple script
tell application id "com.apple.systemevents" to set the value of ¬
attribute "AXMinimized" of every window of every process ¬
to true
end
Automator
App