Skip to content

Instantly share code, notes, and snippets.

@Koze
Last active November 1, 2022 17:11
Show Gist options
  • Select an option

  • Save Koze/2e1a9bf967b2bf865fc9 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

Close all finder windows

tell application "Finder"
	close every window
end tell

@yoland68

Copy link
Copy Markdown

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

@Koze

Koze commented Feb 21, 2022

Copy link
Copy Markdown
Author

@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
Copy Markdown

Gotcha, thank you!

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