I am trying to work on an applescript to hide all apps that are open.
tell application "System Events"
set visible of every process whose visible is true and name is not "Finder" to false
end tell
Unfortunately it is not working as expected.
- The first time when I run it, it hides script editor but not other apps
- The second or third time when I run it, it closes script editor and other apps(but not finder windows)
My goal is as soon as applescript runs, hide all apps that are running
CodePudding user response:
according to Willeke, this works for me :
tell application "System Events"
set visibleApps to every process whose visible is true and name is not "Finder"
repeat with theApp in visibleApps
set visible of theApp to false
end repeat
end tell