AutoHotkey Community

It is currently May 26th, 2012, 4:46 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: September 26th, 2006, 2:20 pm 
Offline

Joined: November 1st, 2005, 4:44 am
Posts: 135
I didn't know how to name it, this script is funny, but after using it for some days on a hotkey i find it useful, so i post it here to expose to ideas from other users.
Even for a beginner like me the code is easy to understand, but the real fun is to test this silly script. Enjoy.

--> Script updated to include 'maximize-restore-minimize' buttons
and buttons for 1024X768 & 800X600 window sizes
:)

Code:
#SingleInstance force
gui, font, cFFDD00 s8, tahoma
gui, color, 324661

;let's build some GUI
gui,add,groupbox,x5 y5 w112 h118 center, Move Win To Edge
gui,add,button, x15 y22 w30 h30 gw1, •
gui,add,button, x47 y22 w30 h30 gw2, T
gui,add,button, x79 y22 w30 h30 gw3, •
gui,add,button, x15 y54 w30 h30 gw4, L
gui,add,button, x47 y54 w30 h30 gw5, •
gui,add,button, x79 y54 w30 h30 gw6, R
gui,add,button, x15 y86 w30 h30 gw7, •
gui,add,button, x47 y86 w30 h30 gw8, B
gui,add,button, x79 y86 w30 h30 gw9, •
gui,add,groupbox, x130 y5 w112 h118 center, Half Screen
gui,add,button, x172 y22 w30 h30 center gw10, •`n-
gui,add,button, x172 y86 w30 h30 center gw11, -`n•
gui,add,button, x140 y54 w30 h30 gw12, •|
gui,add,button, x204 y54 w30 h30 gw13, |•
gui,add,groupbox, x255 y5 w112 h118 center, 1/4 Tile To Edge
gui,add,button, x281 y38 w30 h30 gw14, TL
gui,add,button, x313 y38 w30 h30 gw15, TR
gui,add,button, x281 y70 w30 h30 gw16, BL
gui,add,button, x313 y70 w30 h30 gw17, BR
gui,add,button, x7 y138 w110 h15 gc1024, 1024X768
gui,add,button, x7 y155 w110 h15 gc800, 800X600
gui,add,button, x203 y148 w50 h20 gmin, min
gui,add,button, x260 y143 w50 h25 gres, restore
gui,add,button, x317 y138 w50 h30 gmax, max
Gui, Show, w372 h176, Move/Resize active win to selected positions
Return

guiescape:
GuiClose:
ExitApp

min:
winhide A
winminimize A
exitapp
max:
winhide A   ;hide GUI to work on working window...
winmaximize A
exitapp
res:
winhide A
winrestore A
exitapp
c1024:
winhide A
WinGetPos,,, Width, Height, A
WinMove, A,, 0, 0, 1024, 768
exitapp
c800:
winhide A
WinGetPos,,, Width, Height, A
WinMove, A,, 0, 0, 800, 600
exitapp

w1:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, 0, 0
exitapp
w2:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth/2)-(Width/2), 0
exitapp
w3:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth)-(Width), 0
exitapp
w4:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, 0, (A_ScreenHeight/2)-(Height/2)
exitapp
w5:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)
exitapp
w6:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth)-(Width), (A_ScreenHeight/2)-(Height/2)
exitapp
w7:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, 0, (A_ScreenHeight)-(Height)
exitapp
w8:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight)-(Height)
exitapp
w9:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth)-(Width), (A_ScreenHeight)-(Height)
exitapp
w10:
winhide A
   WinGetPos,,, Width, Height, A
   WinMove, A,, 0, 0, (A_ScreenWidth), (A_ScreenHeight/2)
exitapp
w11:
winhide A
winget, state, MinMax, A
   WinGetPos,,, Width, Height, A
   WinMove, A,, 0, (A_ScreenHeight/2), (A_ScreenWidth), (A_ScreenHeight/2)
exitapp
w12:
winhide A
winget, state, MinMax, A
   WinGetPos,,, Width, Height, A
   WinMove, A,, 0, 0, (A_ScreenWidth/2), (A_ScreenHeight)
exitapp
w13:
winhide A
winget, state, MinMax, A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth/2), 0, (A_ScreenWidth/2), (A_ScreenHeight)
exitapp
w14:
winhide A
winget, state, MinMax, A
   WinGetPos,,, Width, Height, A
   WinMove, A,, 0, 0, (A_ScreenWidth/2), (A_ScreenHeight/2)
exitapp
w15:
winhide A
winget, state, MinMax, A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth/2), 0, (A_ScreenWidth/2), (A_ScreenHeight/2)
exitapp
w16:
winhide A
winget, state, MinMax, A
   WinGetPos,,, Width, Height, A
   WinMove, A,, 0, (A_ScreenHeight/2), (A_ScreenWidth/2), (A_ScreenHeight/2)
exitapp
w17:
winhide A
winget, state, MinMax, A
   WinGetPos,,, Width, Height, A
   WinMove, A,, (A_ScreenWidth/2), (A_ScreenHeight/2), (A_ScreenWidth/2), (A_ScreenHeight/2)
exitapp

_________________
help to be helped


Last edited by iason on October 17th, 2006, 1:20 pm, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 2nd, 2006, 2:33 pm 
Offline

Joined: May 19th, 2006, 4:56 am
Posts: 166
This is pretty effective. Ive tried other window manipulation scripts/programs, and this one is pretty decent.

Thanks :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 2nd, 2006, 7:21 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Nice! Instead of A_ScreenWidth and A_ScreenHeight and absolute screen coordinates 0, I would use the monitor working area, only (SysGet). Otherwise moved windows could overlap the taskbar.

You could simplify the button subroutines, having just one, which does different window moves (If / Else If chain) dependent on the button pressed, but this is not important.

The Gui activation could be assigned to a hotkey, so the active window can be moved repeatedly. In this case the ExitApp's have to be replaced with Return's.

If you change the title of the thread to "Move/Resize active windows to selected positions" or similar, it would be easier to find, and many more of us would give it a try.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2006, 1:02 pm 
Offline

Joined: November 1st, 2005, 4:44 am
Posts: 135
Thanks, i did that! :D

_________________
help to be helped


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2006, 1:16 pm 
Offline

Joined: November 1st, 2005, 4:44 am
Posts: 135
Initial script slightly updated :)

_________________
help to be helped


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanks
PostPosted: May 24th, 2007, 1:34 pm 
Thanks for ur help


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2008, 8:22 pm 
great script thanks!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2008, 11:40 am 
Offline

Joined: December 19th, 2006, 2:14 pm
Posts: 72
Location: France
I like it. thx, idea is good


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2008, 12:17 am 
Offline

Joined: December 6th, 2007, 4:21 pm
Posts: 32
Neato! This is the first window-management tool I have tried, and it's pretty cool! :D I'm sure I'll be playing around now with the source code to learn all about it.

Thanks and great job!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 21st, 2008, 3:08 pm 
Offline

Joined: December 6th, 2007, 4:21 pm
Posts: 32
If anyone is curious, I have altered iason's script using Laszlo's suggestion to better define the bounding area where windows should be placed. Here is what I did.

Near the top of the script, I added the following lines:

Code:
SysGet, monitorDim, MonitorWorkArea, 1
AvailScreenHeight := monitorDimBottom
AvailScreenWidth := monitorDimRight


I then simply replaced every occurrence of A_ScreenHeight with the defined variable AvailScreenHeight, as well as A_ScreenWidth with AvailScreenWidth. It is working great for me (I use Vista).

I hope that helps anyone interested.

Thanks again to both iason and Laszlo.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: JamixZol and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group