Bring back the active off screen window with AutoHotkey

Howdy!

The following script can bring back the Find and Replace window which sometimes goes off screen:
CoordMode, Mouse, Screen
^+m::
    MouseGetPos, x, y
    WinMove A,, %x%, %y%
return

Source: https://www.youtube.com/watch?v=YStr_W9acpw . Check minute 0:30.
Credits to Joe and Isaías.

emoji
Parents
  • It's probably something very obvious, but I don't have much experience with AHK yet. I watched the video, and I don't get what I'm doing wrong, but it doesn't work. The screen does move, but not necessarily to my mouse. Sometimes it even disappears. This is what my script looks like:

    Screenshot of an AHK script with code to bring a window to the mouse position using MouseGetPos and WinMove commands.

    I don't see why that's not correct. Would you have any idea? Below the video, they're saying this:

    Screenshot of a user's comment asking for help about their script not moving the window to the mouse cursor, mentioning they have 4 monitors.

    But what does that effectively mean?

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 4:32 AM (GMT 0) on 5 Mar 2024]
Reply
  • It's probably something very obvious, but I don't have much experience with AHK yet. I watched the video, and I don't get what I'm doing wrong, but it doesn't work. The screen does move, but not necessarily to my mouse. Sometimes it even disappears. This is what my script looks like:

    Screenshot of an AHK script with code to bring a window to the mouse position using MouseGetPos and WinMove commands.

    I don't see why that's not correct. Would you have any idea? Below the video, they're saying this:

    Screenshot of a user's comment asking for help about their script not moving the window to the mouse cursor, mentioning they have 4 monitors.

    But what does that effectively mean?

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 4:32 AM (GMT 0) on 5 Mar 2024]
Children