DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Last post Author Topic: WinManagement Snap & AHKSnap !  (Read 51,496 times)

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
WinManagement Snap & AHKSnap !
« on: January 07, 2008, 06:42 PM »
Ok, so here's a modified version of jgpaiva's WinManagement AHK script (my first try at a "real" AHK script).  :Thmbsup: :)

It doesn't need farr to work and is now a kind of FreeSnap clone... without the undo feature (sorry...) and the incremental resizing (I think that this can already be dealt with properly with Grid move anyways...)... BUT, of  course, with some other features (already existing in WinManagement) : 1-Maximize vertically or horizontally, 2-Toggle On Top/Not On Top, and 3-Maximize/Restore window


Here 'a description of the hotkeys/features (these are mere suggestions : to modify the hotkeys, just modify the script) :


Snap window's borders to edge of the screen :
--------------------------------------------------
WinKey + Up  : snap top window border to screen edge
WinKey + Down : snap bottom window border to screen edge
WinKey + Left : snap left window border to screen edge
WinKey + Right : snap right window border to screen edge


Move window to screen corners :
----------------------------------

WinKey + Home : move window to upper left corner
WinKey + End : move window to bottom left  corner
WinKey + PgUP : move window to upper right corner
WinKey + PgDn  : move window to bottom right corner


Maximize vertically or horizontally :
---------------------------------------

Ctrl + WinKey + Left or Right : Maximize horizontally
Ctrl + WinKey + Up or Down : Maximize vertically


Other common window management :
------------------------------------------

Ctrl + WinKey + PgUP : Maximize/Restore window
Ctrl + WinKey + PgDn : Minimize window
Ctrl + WinKey + Home : Toggle On Top/Not On Top  



Here' the compiled version + the AHK script. To run the uncompiled script, you need to have AHK installed (download it for free).

Edit : 2008 01 07 : new version to better deal with the taskbar.

Edit : 2012 03 20 : completely revamped script by Lanux. See end of thread.
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
« Last Edit: March 20, 2012, 02:02 PM by Armando »

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: WinManagement Snap!
« Reply #1 on: January 07, 2008, 06:53 PM »
That's pretty cool, armando!
Let's see if we can get ourselves another ahk coder for the family ;)

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,081
    • Participated in NANY Challenge Twice
Re: WinManagement Snap!
« Reply #2 on: January 07, 2008, 07:46 PM »

Maximize vertically or horizontally :
---------------------------------------
Ctrl + WinKey + Left or Right : Maximize horizontally
Ctrl + WinKey + Up or Down : Maximize vertically

Thank you, thank you, thank you! I was just going to post in search of these two behaviors. My wish has been granted before I even asked, how's that for greatness?

WinKey + Down : snap bottom window border to screen edge

One minor bug perhaps: the window snaps to physical bottom of the display, i.e. gets underneath the taskbar (if the taskbar is at bottom).

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: WinManagement Snap!
« Reply #3 on: January 07, 2008, 07:51 PM »
That's because armando is using (in the same manner as i was using in winmanagement) the A_screenheight/a_screenwidth variables, which don't take into account the height of the taskbar.

If you'd like to solve this, armando, see this page, specially:
SysGet, OutputVar, MonitorWorkArea,1

That allows you to get the values of the top,right,bottom and left of the screen on the following variables: OutputVarTop, OutputVarRight, OutputVarBottom and OutputVarLeft.

[edit] added explanation[/edit]
« Last Edit: January 07, 2008, 08:04 PM by jgpaiva »

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,081
    • Participated in NANY Challenge Twice
Re: WinManagement Snap!
« Reply #4 on: January 07, 2008, 07:58 PM »
I'll try that, thanks a lot!

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
Re: WinManagement Snap!
« Reply #5 on: January 07, 2008, 08:16 PM »
congrats Armando!

is that like gridmove
I mean is that actually a modified version of gridmove?

if so, do the gridmove keys/grids still work too?
Tom

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: WinManagement Snap!
« Reply #6 on: January 07, 2008, 08:18 PM »
None, tomos :)

It's a modified version of the script i used for this farr alias.

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #7 on: January 07, 2008, 11:12 PM »
Thanks everyone! I just came back.

That's because armando is using (in the same manner as i was using in winmanagement) the A_screenheight/a_screenwidth variables, which don't take into account the height of the taskbar.

Exactly  :-[


If you'd like to solve this, armando, see this page, specially:
SysGet, OutputVar, MonitorWorkArea,1

That allows you to get the values of the top,right,bottom and left of the screen on the following variables: OutputVarTop, OutputVarRight, OutputVarBottom and OutputVarLeft.

[edit] added explanation[/edit]

Thanks jgpaiva ! I shall take a look at that and try to understand... later tonight when I have 5 more minutes! :)

Of course, it would be easy to add many many more features (like scrolling up/down a window -- although that might be a bit tricky for me at that point)... Anybody can modify the script anyways, but if there are other suggestions, I can try...
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #8 on: January 08, 2008, 01:24 AM »
OK, I made the modifications. it should now work whether the taskbar is visible or not, and wherever it's positioned on the screen. Try it and tell me if it works as expected.  :)

(Update the files in my first post)
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,081
    • Participated in NANY Challenge Twice
Re: WinManagement Snap!
« Reply #9 on: January 09, 2008, 02:42 AM »
Works great now, thank you!

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: WinManagement Snap!
« Reply #10 on: January 09, 2008, 03:27 AM »
how did i miss this? great work, Armando.. :Thmbsup: going to d/l & try this..

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #11 on: January 09, 2008, 03:58 AM »
Thanks guys.
It's not much, really.  :-[
It's basically freesnap + WinManagement (by jgpaiva)... Without the "Undo" feature.
But it was fun to "rewrite", yesterday, to take the taskbar in consideration.  :)
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: WinManagement Snap!
« Reply #12 on: January 09, 2008, 04:12 AM »
But it was fun to "rewrite", yesterday, to take the taskbar in consideration.

that's the magic of DC - it makes coders out of users! :) hmm.. now that sounds like a tag-line..

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #13 on: January 09, 2008, 04:31 AM »
Ahah! Yes, it probably does (make, ahem, "coders" out of users).
I think that I always wanted to "code"...
I Hope I'll have more time to learn.
Maybe I'll do like superboyac and learn a bit of C/C++.  :)
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

Ampa

  • I am cute ;)
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 592
Re: WinManagement Snap!
« Reply #14 on: January 09, 2008, 12:59 PM »
Congratulations on your first AHK util.

The funtionality seems very similar to another AHK script that I use... WindowPad. Not a critisism, just an observation!

How does your script differ? What other features (if any) do you think you might add?

Ampa

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #15 on: January 10, 2008, 01:05 AM »
Hi Ampa! Thanks for bringing this to my attention.  :) Looks like a fun script.
Actually, this was just a tiny little exercise for me... The script you're referring to is more elaborate and its features are a bit different since it supports multiple-monitor. WinManagement Snap! (based on jgpaiva's WinManagement and Blue Onion Software's FreeSnap) is mostly to quickly change windows size and shape; so it's main point is to resize a window in the direction you choose, up to the screen border. It also other things, like indicated in the first post of this thread.

Looking at the WindowPad's features, we see that it doesn't exactly do the same thing -- it's more "zone" oriented, like GridMove.

Quote
;  Move and resize windows with Win+Numpad.
;    Win+Numpad1 = Fill bottom-left quarter of screen
;    Win+Numpad2 = Fill bottom half of screen
;    etc.
;
;  Move windows across monitors. For example:
;    Win+Numpad4 places the window on the left half of the screen.
;    Win+Numpad4 again moves it to the monitor to the right.
;
;  Quick monitor switch:
;    Win+Numpad5 places the window in the center of the screen.
;    Win+Numpad5 again moves the window to the next monitor.
;    (This works by monitor number, not necessarily left to right.)
;
;  QUICKER Monitor Switch:
;    Win+NumpadDot switches to the next monitor (1->2->3->1 etc.)
;    Win+NumpadDiv moves ALL windows to monitor 2.
;    Win+NumpadMult moves ALL windows to monitor 1.
;
;  Other shortcuts:
;    Win+Numpad0 toggles maximize.
;    Insert (or some other key) can be used in place of "Win".
;
; Credits:
;  Concept based on HiRes Screen Splitter by JOnGliko.
;  Written from scratch by Lexikos to support multiple monitors.
;  NumpadDot key functionality suggested by bobbo.
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: WinManagement Snap!
« Reply #16 on: January 10, 2008, 01:19 AM »
Cool, WindowPad has some interesting features! :)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: WinManagement Snap!
« Reply #17 on: January 10, 2008, 02:13 AM »
good find, Ampa but it does look a bit elaborate.. :)

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #18 on: January 10, 2008, 03:00 AM »
What other features (if any) do you think you might add?

I forgot to answer that question...
In terms of features, I didn't really think of any others for now, but if some have suggestions, who knows.  :)
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

Nxqd3051990

  • Train to become GTD Master
  • Participant
  • Joined in 2006
  • *
  • Posts: 78
Re: WinManagement Snap!
« Reply #19 on: March 26, 2008, 11:19 AM »
Aha, cool program  :Thmbsup:
KEEP IT SIMPLE !
Hardware ASUS K8N |AMD 2800+@2,6 with WC| Ram Kingmax 512@235 2-4-4-11
Software   Firefox 2.0.0.5 | XYplorer | Foobar 0.9.4.2 | VLC | AutoHotkey | SciTe | Pidgin
Sites Y!Blog | Facebook | Tumblog | Last.fm

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #20 on: March 27, 2008, 02:06 AM »
Thanks!  :)
Really, it's nothing. I played with jgpaiva's script (that he made for a farr plugin) and added a few little things from Blue Onion Software's FreeSnap... If you look at the script, you'll probably also find that's not hard to modify to your liking.
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
AHKSnap!
« Reply #21 on: March 20, 2012, 01:35 AM »
NECRO THREAD ALERT

i had modified the original WinManagement Snap script to add/remove a few things, such as:
added
snap undo, center windows (win+numpad5) and incremental resizing (win+numpad plus/minus)

removed
resize vertically or horizontally,  max/min window, and toggle on top feature.

so with Armando's permission, here is the modified script (ahk+exe), feel free to modify it for your own purposes.

note: to add/remove resolutions for the incremental resizing feature, you may need to edit AhkSnap.ini.

Quote from: "AhkSnap.ini"

;variables here
size1= 320,240
size2= 640,480
size3= 800,600
size4= 1024,768
size5= 1152,864
size6= 1280,600
size7= 1280,720
size8= 1280,768
size9= 1280,800
size10= 1360,768
size11= 1440,900

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #22 on: March 20, 2012, 03:13 AM »
:Thmbsup:
Cool ! I like it. Much, much better and sophisticated. It's a completely new script.

Of course, as I told you, that was my first baby step into the scripting/programming world... Didn't know anything at the time. I still feel like I know nothing, but that's another story.  ;D

The exe works perfectly.

The AHK file gives me an error : "IniRead" requires at least 4 parameters. I quickly added "size9" as the last argument. Not sure that this is the best way though -- just did what seemed obvious without too much thinking. (The reason I'm trying the AHK file is that I usually append all the little scripts together in a bigger script... less processes to manage).
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: WinManagement Snap!
« Reply #23 on: March 20, 2012, 03:24 AM »
The AHK file gives me an error : "IniRead" requires at least 4 parameters. I quickly added "size9" as the last argument. Not sure that this is the best way though --

sorry about that, Armando. i forgot to mention that the newer script uses AutoHotkey_L (a custom build of AutoHotkey). AHK_L's IniRead command is slightly different, that's why you're getting that error. :)

You can learn more about AHK_L, here.

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: WinManagement Snap!
« Reply #24 on: March 20, 2012, 01:59 PM »
Interesting. I just installed it but am having problems with various scripts. Will revert to the plain AHK for now and will check later.
(Of course, the compiled version of AHKSnap isn't affected at all -- just saying this for others reading following the thread !)
Thanks Lanux.


(EDIT : BTW Lanux, if you want to create a new thread -- or split this one -- for AHKSnap, you can... It's different enough to justify it. It's really up to you.  :) )
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
« Last Edit: March 20, 2012, 02:05 PM by Armando »

Original address: https://www.donationcoder.com/forum/index.php?topic=11725.0