Simple Window Switcher

**UPDATE** - @devoy had a better solution using KM tokens, and I've incorporated his/her solution into a version 2.0 of this macro. Thank you, devoy!

WINDOW SWITCHER 2.0.kmmacros (22.6 KB)


I am leaving the rest of this post as it was in case folks find the Applescripts useful as examples.

– – – – – – – – – – – – –

This macro allows the user to quickly switch between app windows (e.g., documents) by leveraging the Prompt With List function and Applescript. I find it faster and more intuitive to use than automating the "Window" menu item or using KM's native window switcher. I wanted especially to be able to have this functionality for Microsoft Word, Preview, and TextEdit, apps for which I frequently have multiple documents open concurrently.

There are two versions of this macro because the scripting for Word and TextEdit, which incorporates the "AXRaise" action, does not work for Preview. I used a workaround for Preview, and it does the same thing. You can try to make the macros work for other apps by replacing the app name within the two Applescript actions.

I did not try using KM tokens for this exercise, but it may be that experimentation with KM tokens could yield a more universal macro.

Macro version 1 - works with Word and TextEdit (and likely other apps):

WINDOW SWITCHER.kmmacros (24.0 KB)


Macro version 2 - works with Preview (and likely other apps):

WINDOW SWITCHER - ALT.kmmacros (24.3 KB)


Change app name within the scripts to make it work with a different app.


Doesn't this do the job?


Yep, it sure does, thanks!