Thanks Chris, thanks Sleepy,
I've been exploring this idea that I mentioned in the OP:
The hotkey is for changing Desktop Workspaces. If I can trigger a change to a new desktop with a hotkey while I am holding a window in motion when I do, the window comes along with me to the new desktop. This works with the core Apple Mission Control hotkeys for desktop changing and it works with every other system I've found of changing desktops, as long as you can hold on the to app window with the mouse.
But I'm working on changing desktops based on a Prompt With List action, and there is no way that I can respond by picking from the PWL List without letting go of the app window that I'm trying to move. (The programming of PWL is so much simpler than the long way around the barn of creating a Conflict Palette by creating a separate macro for each choice in the List.)
So in my macro I want to be able to distinguish between whatever just happens to be the frontmost app window when I invoke the PWL and the times when I really want to be moving that frontmost app window to the new desktop. I think that simply determining the mouse state when the macro starts (is the left mouse button down?) is enough. I don't need to actually know that anything has been moved, I just need to know that it has been chosen.
In my current version of the macro, if the mouse button is down, then I give a 3 sec delay before moving, and tell the user to re-grab the window after the PWL List disappears. It works reasonably well.
But my KM perfectionism wants to be able to automatically re-grab the window, to save that step.
So, after telling the Desktop changing macro where I want to go, how do I get KM to click and hold the title bar of the previously selected window, after I've let go of the window to be able to make the PWL choice?
I can see two routes:
If the mouse is down, determine the active window. After the PWL choice, bring that window to the front (or assume it already is) and find the title bar and click and hold. Then perform the PWL choice to move to the new desktop and release the mouse.
If the mouse is down, remember the mouse location. After the PWL choice, move the mouse to that location again and click and hold. Then perform the PWL choice to move to the new desktop and release the mouse.
Just writing it out to explain what I'm trying to do has clarified my thinking. I had been working on the first idea, based on the "what", what I'm trying to do is hold the window by its title bar. Now I think the second idea might be simpler based on the "how", how I'm holding the title bar is by having the mouse button down and using the position of the mouse.
Any other ideas? Does anyone foresee any problems with either of these routes?