Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Open windows where mouse pointer is?


  • Please log in to reply
9 replies to this topic
KenC
  • Members
  • 17 posts
  • Last active: Jan 31 2013 07:39 AM
  • Joined: 14 Oct 2009

I use a multi monitor setup and my monitors are not next to each other so I'm always fighting with windows and dialogs that opens on the monitor I'm not sitting at, I switch from one monitor to the other a lot so and some of the apps I use opens a ton of dialogs for various functions, it becomes a major pain to constantly move windows. 

 

It would be super helpful to have a utility that just moved whatever window or dialog that opens to the monitor where my mouse pointer is, I've searched and googled but found nothing.

 

Can this be done in AHK or does someone know a utility that does this?



nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010

The shell receives messages whenever a Window is being Created/Activated/Detroyed etc. This topic discusses on hooking Shell messages and the possible uses.

http://www.autohotke...e-its-messages/

Note: HSHELL_WINDOWCREATED = 1

 

See also:

http://d.ahk4.me/~MouseGetPos

http://d.ahk4.me/~WinMove



ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008

http://www.dummies.c...e-settings.html

 

Control the mouse’s pointer

 

Snap to



nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010

http://www.dummies.c...e-settings.html

 

Control the mouse’s pointer

 

Snap to

That's backwardstongue.png



ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008

But with the same effect.tongue.png tongue.png



KenC
  • Members
  • 17 posts
  • Last active: Jan 31 2013 07:39 AM
  • Joined: 14 Oct 2009

http://www.autohotke...e-its-messages/

Note: HSHELL_WINDOWCREATED = 1

 

See also:

http://d.ahk4.me/~MouseGetPos

http://d.ahk4.me/~WinMove

 

Bingo, thanks cool.png 

 

 

http://www.dummies.c...e-settings.html

 

Control the mouse’s pointer

 

Snap to

 

Hehe, Well I'd have to turn my head like an owl to see what I'm doing.

 

It's really something that should be an OS option.

 

 I can't be the only one using multiple monitors not next to each other.



nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010

If you need help with this script, post it in Ask for Help and PM me the link.



willgonz
  • Members
  • 1 posts
  • Last active: Apr 30 2014 10:57 PM
  • Joined: 30 Apr 2014

Did you ever get this to work?  I am interested in the same thing.



akbars
  • Members
  • 10 posts
  • Last active: Jul 28 2017 02:22 PM
  • Joined: 23 Jun 2014

I've been looking at this for myself and I've created a script. This listens for win w and then shoots the window to the current mouse location.

 

 

Move window to mouse. 

#w::
{
WinGetTitle, Title2, A

; Activate top window 
WinActivate, %Title2%

; This un-maximizes fullscreen things to prevent UI bug. 
WinRestore, %Title2%

; Mouse screen coords = mouse relative + win coords therefore..
WinGetPos, xtemp, ytemp,,, A ; get active windows location
MouseGetPos, X, Y   ; get mouse location 

;; Calculate actual position
;; -16 on x and y pos allows you to doubleclick and close window(most of the time) 
xpos:=X+xtemp-16
ypos:=Y+ytemp-16

WinMove, %Title2%, , %xpos%, %ypos%  ; move window to mouse 
} 

My next step will be to try to get it to do this automatically by listening for a new window under a certain size for example. 

 

Hope this helps.



akbars
  • Members
  • 10 posts
  • Last active: Jul 28 2017 02:22 PM
  • Joined: 23 Jun 2014

I also created a very similar move mouse to window with Win Q

#q::
{

WinGetTitle, Title2, A

; Activate top window 
WinActivate, %Title2%

;WinGetPos, xtemp, ytemp,,, A

; 10 is speed, 16, 16 is a good place to doubleclick and close window. 
MouseMove, 16, 16, 10
Return
}