shortkey to quickly moving windows

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
yardeni
Posts: 4
Joined: 24 Jan 2017, 17:10

shortkey to quickly moving windows

13 Sep 2017, 21:06

Hey all.

The current way to do what I wish, is to select the window you want to move,
click alt+space -->m-->arrow key

I'd like to create a shortkey that does all that using ctrl+m.

Would be incredible on my ultrawide screen :)
User avatar
divanebaba
Posts: 809
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: shortkey to quickly moving windows

15 Sep 2017, 12:34

Hi.
My english is not the best, because getting education in Germany for foreigners is like getting american visa for muslims.
But this will not stop solving your problem.
Try this:

Code: Select all

^m::									
WinGetActiveStats, Title, W, H, X, Y
WinGetPos, X_Gui, Y_Gui, W_Gui, H_Gui, %Title%
WinGet MX, MinMax, A
IfEqual, Title, Progman, Return
WinMove, A,, 1280, 0, % MonitorRight/2, % MonitorBottom /2
return
Modifiying another position is easy, after understanding the parameters of WinMove command.
Einfach nur ein toller Typ. :mrgreen:
yardeni
Posts: 4
Joined: 24 Jan 2017, 17:10

Re: shortkey to quickly moving windows

16 Sep 2017, 13:30

Haha. Thank you for responding divanebaba!
I got your English just fine.
Your script takes the active window to a specific location on the screen. It's quite useful on its own right, but what I was looking for was a little different, and I actually ended up finding it for myself:

Code: Select all

^!SPACE::  send !{space}m{Right}
	
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: shortkey to quickly moving windows

16 Sep 2017, 13:42

This will do the same thing as your existing script, but it also allows you to safely hold down the hotkey (without triggering something else by accident):

Code: Select all

^!Space::
PostMessage, 0x112, 0xF010,,, A ;WM_SYSCOMMAND := 0x112 ;SC_MOVE := 0xF010
Send, {Right}
return
As with your script, you would need to press Enter to confirm the location, or Esc to cancel. Possibly some other keys would also work.

Using info from:
How to open the context menu of the window's title bar - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 70#p165570

==================================================

Here is a slightly different script, that may also give you quite good results:

Code: Select all

q:: ;move window right
WinGetPos, vWinX,,,, A
vWD := A_WinDelay
SetWinDelay, -1
WinMove, A,, % vWinX+17
SetWinDelay, % vWD
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Aqualest, jdfnnl and 335 guests