Hide All Windows in macOS

This works on macOS 11

tell application "System Events"
	repeat with x in (get name of processes whose visible is true)
		set visible of process x to false
	end repeat
end tell

along with usage and download details

-- - Notice
--   - macOS will notify you to grant access to all of these uses
--   - Finder.app retains focus it launches this one
--   - Attribution
--     - https://stackoverflow.com/questions/68583645/hiding-minimizing-maximized-windows-using-applescript/68614663#68614663
-- - Command-Line
--   - Open Terminal.app
--   - Run the command
--     - osascript MinAllWin.scpt
-- - ScriptEditor.app
--   - Open MinAllWin.scpt
--   - Script -> Run
-- - Application
--   - Open MinAllWin.scpt in ScriptEditor.app
--   - File -> Export
--   - File Format: Application
--   - Code Sign: Sign to Run Locally
--   - Copy MinAllWin.app into Applications and run

and the actual file you can download here (rename from .txt to .applescript).

Leave a Reply

Your email address will not be published. Required fields are marked *