Thanks, but it's the name/title that I'm querying for. As long as I'm constantly getting the name/title as something that I can turn around and open again when I need to, and get to the file/window that I queried about in the first place, that's all I need.
FYI, not part of the original question, here's what I doing with this:
TL;dr: It's how I keep track of which desktops I've accessed, getting the name/title of the window on each desktop that names that desktop.
I'm trying Moped because it's an Open Source text editor, which means whenever I learn enough about Xcode to get it to build, then I can change the name to something meaningful to me in the context where I'm using it. What makes Moped stand out is that it's well supported, very small, and does the magical act of all open windows reopen in their original Mission Control Desktops when the system reboots.
I put a little Moped window in the botton corner of each desktop, where the name of the file is the name I want to give to that Desktop. Now that KBM, as of v11.0, has a "Space Changed" trigger, whenever the Space changes, I look for the name of the Moped (hopefully to be renamed soon) window on that Desktop. That's where the above AppleScript comes in.
I take each new Desktop name, as it comes up from the successive Space Changed triggers, and add it to the top of a variable list, deleting it wherever it previously appears in the list, a push-down stack of Desktop Space Names.
This list now allows me to have a hotkey that opens the second item on the list with Moped, which is the name of the previous Desktop I was on, which moves me to that Desktop. I also can display a Prompt With List of all the items in that list, thereby offering me the choice of all my Desktops in most-recently-used order.
And it all depends on that AppleScript above, which lets me get the name of the current Moped window after a Space Change.
I had been doing this with a clone of TextEdit (which I called DeskSpaceID.app) that I had built from the public source to TextEdit v1.9 that's available on developer.apple.com, but while my current version of TE, v1.15, also does the magic of reopening windows in their original Desktop Spaces after a reboot, v1.9 does not, much to my disappointment. So every time I reboot, I been having to recreate all the RTF windows. Even with KBM scripts, it's awkward.
Using Moped eliminates that, when I reboot, there's no additional setup before I can use all my Desktop hotkeys.
I was hugely disappointed when I thought that I couldn't get the Moped window names with AppleScript. Thanks agian, Chris @cdthomer for your help in fixing that.