Skip to content

Instantly share code, notes, and snippets.

@digiltd
Last active November 3, 2022 13:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digiltd/e1d84e44ab8b911ed8f7bc7cc33e9555 to your computer and use it in GitHub Desktop.
Save digiltd/e1d84e44ab8b911ed8f7bc7cc33e9555 to your computer and use it in GitHub Desktop.
Count the amount of finder windows
property finderwindownumber : 1
tell application "Finder"
set TotalNumberOfFinderWindows to (count of (every window where visible is true))
if TotalNumberOfFinderWindows is greater than 0 then
tell application "Finder"
select window finderwindownumber
activate
set finderwindownumber to finderwindownumber + 1
if finderwindownumber is greater than TotalNumberOfFinderWindows then
set finderwindownumber to 1
end if
end tell
else
tell application "Finder" to open home
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment