Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Thursday, September 13, 2007

[Windows] AutoHotKey for fast window positioning

You can do some neat things with AutoHotKey (Windows scripting program). This morning I assigned some scripts to my numeric keypad to position the current window in vertical slots:

7 - left half of screen A
8 - right half of screen A
9 - left half of screen B
+ - right half of screen B

These next ones position the current window in horizontal slots:

4 - top half of screen A
5 - top half of screen B
1 - bottom half of screen A
2 - bottom half of screen B

Two keys for full screen:

/ - full screen A
* - full screen B

Here's the AutoHotKey code (tweak the numbers for your screen size):

Numpad7::
WinGetActiveTitle, Title
WinMove,%Title%,,-1735,0,868,1200
return

Numpad8::
WinGetActiveTitle, Title
WinMove,%Title%,,-868,0,868,1200
return

Numpad9::
WinGetActiveTitle, Title
WinMove,%Title%,,0,0,700,1050
return

NumpadAdd::
WinGetActiveTitle, Title
WinMove,%Title%,,700,0,700,1050
return

Numpad4::
WinGetActiveTitle, Title
WinMove,%Title%,,-1735,0,1735,600
return

Numpad1::
WinGetActiveTitle, Title
WinMove,%Title%,,-1735,600,1735,600
return

Numpad5::
WinGetActiveTitle, Title
WinMove,%Title%,,0,0,1400,525
return

Numpad2::
WinGetActiveTitle, Title
WinMove,%Title%,,0,525,1400,525
return

NumpadDiv::
WinGetActiveTitle, Title
WinMove,%Title%,,-1735,0,1735,1200
return

NumpadMult::
WinGetActiveTitle, Title
WinMove,%Title%,,0,0,1400,1050
return

3 Comments:

  • Hi Jon,

    I love autohotkey and had a similar thing until recently when I can across a util called WinSplit Revolution. Have a look over at:

    http://reptils.free.fr/

    Stu

    By Blogger Stuart Holden, at 9/14/2007 1:18 AM  

  • Cool, I sometimes split my screen in a 50/50 vertical (I have a widescreen), but I don't have hotkeys for it. I have for fullscreen, restore etc, but not the split.

    Now, the quest to find a way to do this in KDE begins..

    By Blogger Thomas Bergheim, at 9/14/2007 2:36 AM  

  • Thanks Stu - I'll check it out!

    Thomas - Thanks for stopping by - Hopefully KDE has a similar sort of macro program.

    By Blogger Jonathan, at 9/14/2007 6:54 PM  

Post a Comment

<< Home