- Share this text:
AASS - posted by guest on 11th December 2020 07:11:22 AM
tell application "System Events"
set currentProcesses to name of every application process whose visible = true
end tell
set tmpWindows to 0
repeat with tmpProcess in currentProcesses
tell application tmpProcess
activate
try
set tmpWindows to count windows
on error
set tmpWindows to 1 --> # of windows to try to force closed if it doesn't 'appear' to have any windows
end try
end tell
if tmpWindows > 0 then
tell application "System Events"
tell application tmpProcess
repeat tmpWindows times
try
keystroke "m" using command down
end try
end repeat
end tell
end tell
end if
set tmpWindows to 0
end repeat