topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 12:56 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: WinFill - better than Aero Snap?  (Read 12219 times)

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
WinFill - better than Aero Snap?
« on: January 11, 2009, 06:12 PM »
 :) Waiting for Windows 7?

WinFill - Drag a window to the edges of the screen to resize it.

Idea stolen from Windows 7's Aero Snap, but with more zones.

A  B  C  D  E

F             G

H             I

J   K      M N

A = top left corner = resize to fill top left quarter of the screen
B = top left           = resize to fill left half of the screen
C = top center      = maximize
...
F = left top          = resize to fill upper half of the screen
...

Try it!

Skrommel

;WinFill.ahk
; Drag a window to the edges of the screen to resize it
; A  B  C  D  E
;
; F           G
;
; H           I
;
; J  K    M   N
;Skrommel @ 2009

#SingleInstance,Force
SetWinDelay,0
CoordMode,Mouse,Screen
;CoordMode,ToolTip,Screen


~LButton::
MouseGetPos,mx0,my0,mwin1,mctrl1
WinGetPos,wx1,wy1,ww1,wh1,ahk_id %mwin1%
mx1:=mx0-wx1
my1:=my0-wy1
Return


~LButton Up::
MouseGetPos,mx2,my2,mwin2,mctrl2
SysGet,dragx,68
SysGet,dragy,69
If (mx2>=mx0-dragx And mx2<=mx0+dragx And my2>=my0-dragy And my2<=my0+dragy)
  Return

WinGet,progman,Id,Program Manager ahk_class Progman
If (progman=mwin1)
  Return
WinGetPos,wx2,wy2,ww2,wh2,ahk_id %mwin1%
mx3:=mx2-wx2
my3:=my2-wy2
SysGet,monitors,MonitorCount
Loop,% monitors
{
  current:=A_Index
  SysGet,monitor,Monitor,% current
  If (mx2>=monitorLeft And mx2<=MonitorRight And my2>=MonitorTop And my2<=MonitorBottom)
    Break
}
SysGet,monitor,MonitorWorkArea,% current
;ToolTip,%current%:%monitorLeft%-%monitorTop%-%mx2%-%my2%,100,100

If (mx3<>mx1 Or my3<>my1)
  Return
If (ww2<>ww1 Or wh2<>wh1)
  Return

If (mx2<=monitorLeft)
{
  If (my2=monitorTop)        ;topleft
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorTop,% monitorRight/2,% monitorBottom/2 ;topleft
  Else
  If (my2>monitorTop And my2<monitorBottom/4)        ;topleft
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorTop,% monitorRight,% monitorBottom/2 ;top
  Else
  If (my2>=monitorBottom/4 And my2<monitorBottom/4*3) ;middleleft
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorTop,% monitorRight/2,% monitorBottom ;left
  Else
  If (my2>=monitorBottom/4*3 And my2<monitorBottom-1)  ;bottomleft
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorBottom/2,% monitorRight,% monitorBottom/2 ;bottom
  Else
  If (my2=monitorBottom-1)  ;bottomleft
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorBottom/2,% monitorRight/2,% monitorBottom/2 ;bottomleft
}
Else
If (mx2>=monitorRight)
{
  If (my2=monitorTop)        ;topright
    WinMove,ahk_id %mwin1%,,% monitorRight/2,% monitorTop,% monitorRight/2,% monitorBottom/2 ;topright
  Else
  If (my2>=monitorTop And my2<monitorBottom/4)        ;topright
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorTop,% monitorRight,% monitorBottom/2 ;top
  Else
  If (my2>=monitorBottom/4 And my2<monitorBottom/4*3) ;middleright
    WinMove,ahk_id %mwin1%,,% monitorRight/2,% monitorTop,% monitorRight/2,% monitorBottom ;right
  Else
  If (my2>=monitorBottom/4*3 And my2<monitorBottom-1)  ;bottomright
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorBottom/2,% monitorRight,% monitorBottom/2 ;bottom
  Else
  If (my2=monitorBottom-1)  ;bottomright
    WinMove,ahk_id %mwin1%,,% monitorRight/2,% monitorBottom/2,% monitorRight/2,% monitorBottom/2 ;bottomright
}
Else
If (my2<=monitorTop)
{
  If (mx2>=monitorLeft And mx2<monitorRight/4)        ;topleft
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorTop,% monitorRight/2,% monitorBottom ;left
  Else
  If (mx2>=monitorRight/4 And mx2<monitorRight/4*3)     ;topmiddle
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorTop,% monitorRight,% monitorBottom ;full
  Else
  If (mx2>=monitorRight/4*3 And mx2<=monitorRight)     ;bottom
    WinMove,ahk_id %mwin1%,,% monitorRight/2,% monitorTop,% monitorRight/2,% monitorBottom ;right
;    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorBottom/2,% monitorRight,% monitorBottom/2 ;topright
}
Else
If (my2>=monitorBottom-1)
{
  If (mx2>=monitorLeft And mx2<monitorRight/4)        ;bottomleft
    WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorTop,% monitorRight/2,% monitorBottom ;left
  Else
;  If (mx2>=monitorRight/4 And mx2<monitorRight/4*3)     ;bottommiddle
;    WinMinimize,ahk_id %mwin1% ;WinMove,ahk_id %mwin1%,,% monitorLeft,% monitorTop,% monitorRight,% monitorBottom ;full
;  Else
  If (mx2>=monitorRight/4*3 And mx2<=monitorRight)     ;bottom
    WinMove,ahk_id %mwin1%,,% monitorRight/2,% monitorTop,% monitorRight/2,% monitorBottom ;right
}
Return
« Last Edit: January 11, 2009, 07:36 PM by skrommel »

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #1 on: January 12, 2009, 12:03 AM »
Hi

It does not do anything under vista? I cannot make it work. Might it be a code copy paste problem?
« Last Edit: January 12, 2009, 12:07 AM by kartal »

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #2 on: January 12, 2009, 12:05 AM »
Btw check this app, this one has been around for a while and does the same thing pretty much


http://winsplit-revolution.com/

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #3 on: January 12, 2009, 02:49 AM »
 :tellme: That's odd, I'm running Vista, too. It should just be a matter of taking a window by it's caption and dropping it on a screen edge. Try the upper left corner and let me know.

Skrommel

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #4 on: January 12, 2009, 03:06 AM »
no one heard of 'gridmove' https://www.donation...dex.php?topic=3824.0 around here? the original idea was for resizing the window by dragging to the edge of the screen - but it grew into a program that did far more than that. (i know Skrommel saw the original post as there's a comment about 'ZoneSize'.)

having said that. i thought aerosnap worked well on vista - but it seems to crash. so, i'll give 'winfill' a try.

Skrommel, just wondering, does 'winfill' do the auto resize to original window size when you drag the window back into the center of the screen? that seemed to be one of the best features of 'aerosnap'.
« Last Edit: January 12, 2009, 03:30 AM by nudone »

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #5 on: January 12, 2009, 03:15 AM »
just thought. i made a request to see if jgpaiva could make 'gridmove' work by 'throwing' windows to resize them.

perhaps this could be done with 'winfill'?

the idea was get the same result when dragging to the edge of the screen - but instead you 'throw' the window (using the titlebar) in a particular direction that would determine the size and position of the window.

e.g. throw window to the left - the window resizes to fill the left half of the screen.

the problem being, does autohotkey understand 'throws'?

a throw would be a 'click and hold on title bar, quick drag, release mouse, continue drag direction a little'.

edit:
forgot to say, jgpaiva may try to get the 'throw' idea to work with 'gridmove' but i think it depends on how busy he is.
« Last Edit: January 12, 2009, 03:26 AM by nudone »

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #6 on: January 12, 2009, 03:23 AM »
i like 'winfill'. nice and quick but it really needs the 'auto resize' to original window size for it to be as useful as 'aerosnap'.

any chance of implementing that Skrommel?

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #7 on: January 12, 2009, 11:05 AM »
not sure why it is not working. I tried it under xp64 as well. I have windows 7 here so i know the behaviour :)

Hirudin

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 543
    • View Profile
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #8 on: August 05, 2009, 02:45 PM »
I've been thinking about asking if something like this could be done. I was searching google for ideas and wouldn't you know it, the solution is on a website I check nearly every day... LOL

I haven't actually tried it (I'm a lil' reluctant to install autohotkey for some idiotic reason) but I'll be sure to soon.

Coeluh

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 273
  • Family Guy ^^
    • View Profile
    • Jeroen Coelen
    • Donate to Member
Re: WinFill - better than Aero Snap?
« Reply #9 on: August 15, 2009, 12:04 PM »
Does not work here :(