Thanks, Chris (@ccstone),
I finally tried this script out. It looks like a good starting point for what I have in mind. I'll keep you posted on that.
I made a small mod to the output to make it more compact. I changed the line to:
set contents of appName to {"# " & appName & " :" } & item _cntr of appWindowNameList & ""
I'm really curious why you appended an empty string, ""
at the end. Why not just end the line with the desired element of appWIndowNameList
?
With that mod, here's my output for my KBM desktop:
# Script Editor :
a03AM-CallKBMOnSpaceChange.scpt
Untitled
# Keyboard Maestro :
New Action
Keyboard Maestro Editor — List All WIndows of Current Desktop
# Google Chrome :
How to List All Open Windows on a Desktop - Questions & Suggestions - Keyboard Maestro Discourse - Google Chrome - August
# TextEdit :
Window= K KeyboardMaestro.rtf
# CurrentKey Stats :
K KeyboardMaestro
# Brave Browser :
# FoldingText :
# TextDo :
# System Preferences :
# Notes :
# Safari :
# TextMate :
# Terminal :
Keyboard Maestro — -bash — 80×24
# Activity Monitor :
# Typora :
# Finder :
Keyboard Maestro
# a03AM-CallKBMOnSpaceChange :
There's the Finder window open at my Keyboard Maestro
folder, a Terminal window open at the same directory, TextEdit open with my Keyboard Maestro.rtf
file, Google Chrome open at this page (the other 12 tabs are not listed), etc. And several open apps with no windows on this Desktop. Every other window I can account for, except one: The "New Action" window in KBM. I figure that's the overlay window in the editor.
So this is really good info.
Of note is the Current Key window which I believe is the hidden window (positioned behind the toolbar, IIRC from other window data) that CK uses to switch focus to and thus switch to this desktop on demand.
As you might have gathered from other posts of mine, because Current Key has been withdrawn because the author does not want to support Monterey, etc., I'm looking to find a way to emulate the feature of CK that matters most to me, the Desktop identification and switching functions.
This script above is another step towards that.
Thank you.