Skip to content

Instantly share code, notes, and snippets.

@Koze
Last active November 1, 2022 17:11
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Koze/2e1a9bf967b2bf865fc9 to your computer and use it in GitHub Desktop.
Save Koze/2e1a9bf967b2bf865fc9 to your computer and use it in GitHub Desktop.
Close all windows with AppleScript
tell application "Finder" to close windows
# index 1 is frontmost window
tell application "Finder" to close window 1
@confluencepoint
Copy link

Close all finder windows

tell application "Finder"
	close every window
end tell

@yoland68
Copy link

This doens't work for me, it only closes Finder windows : /

@Koze
Copy link
Author

Koze commented Feb 21, 2022

@yoland68
Because tell application "Finder" means to work on Finder.
If you want to work with all applications, I think you need to take the list of applications and tell application to each one.

@yoland68
Copy link

Gotcha, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment