Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

moving windows

  • Please log in to reply
2 replies to this topic
  • Guests
  • Last active:
  • Joined: --
Hello, can anyone think of a creative way to move a window without knowing it's title? I'm trying to program the feature where I can move a window by click-dragging anywhere in the window, as opposed to only the title bar.

WinMove function operates on a window by title or last found window ... along these lines is there a way to select a window by where the mouse is positioned?

Thanks, this is a really great project!

  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
You can set the "last found" window to be the active window as in this example:

WinWait, A ; The active window is now the "last found" window.
Send, !{tab} ; Temporarily switch to another window.
Sleep, 1000
WinActivate ; Now activate the "last found" window again.

Once the "last found" window has been established, you can move it without knowing its title by using an abbreviated version of WinMove:

WinMove, 100, 100 ; Moves the last found window to a new position.

However, I doubt this helps you since to establish the "last found" window in the first place, the window had to have been active, in which case you would have been able to determine its title anyway.

To answer your other question, there's really no way in AHK to figure out which window the mouse cursor is hovering over (unless it happens to be the active window). And although I'm pretty sure there's a way to write a program to do so, offhand I don't even know how to do that.

  • Guests
  • Last active:
  • Joined: --
well I came up with one possible solution that meets my needs .. it's kind of a hack, but what I did is use Tweak UI to tell windows to enable the "activation follows mouse" feature, so I just point my mouse wherever and the window is active.. Next I temporarily rename the window to something unique, at which point you can reliably do whatever to that window. If I understand your last post correctly temporarily selecting another window then reactivating the last found window would work as well. I posted my script into the "Scripts and Utilities" forum.