Cycle through open finder windows?

I want to create a macro that when ctrl + space is pressed

  1. if a finder window is open, brings the last finder window to the front
  2. if there are multiple finder windows open, pressing the shortcut again will bring the next window to the front (i.e if three finder windows are open, pressing the shortcut will bring the latest window to front, pressing it again will bring the next window to the front, and so on).

gglick kindly helped me out with a similar macro for google chrome, but for some reason replacing the "activate google chrome" action with an "active finder" action doesn't work for me.

Link to that post: https://forum.keyboardmaestro.com/t/rotate-through-open-chrome-windows/18329

Finder is a unique case in that the desktop is counted as a window for indexing purposes (at least according to KM's WINDOWCOUNT() function). In other words, 3 Finder windows are counted as 4, which prevents the macro from successfully bringing the window with the last index forward. Fortunately, it's easy enough to fix: just subtract 1 from the window count.

2 Likes

Thanks as always!

1 Like