repeat
delay(.1)
tell application "System Events"
repeat with appProc in (every application process whose visible is true)
click (first button of every window of appProc whose role description is "minimize button")
end repeat
end tell
end repeat
Why do you have 2 repeat loops?
try this
tell application "System Events"
repeat with appProc in (every application process whose visible is true)
delay 0.1
click (first button of every window of appProc whose role description is "minimize button")
end repeat
end tell
Why have any repeat loops ?
tell application "System Events" to tell every window of every process to set the value of attribute "AXMinimized" to true
AppleScript: 2.7
Browser: Safari 605.1.15
Operating System: macOS 10.13