AutoHotkey Community

It is currently May 26th, 2012, 3:15 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: February 15th, 2009, 12:15 am 
Offline

Joined: January 25th, 2009, 9:18 pm
Posts: 34
A few weeks ago, the Windows 7 Beta was released to the public - a key feature was the ability to dock windows to different parts of the screen in order to view several windows at the same time.

This incredibly simple script does the same thing, allowing you to compare documents, or view a webpage at the same time as a document. It's particularly useful when combined with a big desktop monitor.

Hotkeys may be customised via a simple, GUI interface.

If you would like the custom icon, I have packaged it with the script at http://softwareguider.110mb.com/downloads/window_resizer.zip

I hope you enjoy ...

Code:
#singleinstance ignore
SetWorkingDir %A_ScriptDir%

FileInstall, C:\Documents and Settings\ETIENNE\Bureau\David\Website Stuff\Window Resizer\window_resizer.ico, %A_WorkingDir%\window_resizer.ico,0

IfExist, %A_WorkingDir%\window_resizer.ico
{
Menu, TRAY, Icon, %A_WorkingDir%\window_resizer.ico,,1
}

GoSub, INI
GoSub, TRAYMENU
GoSub, START
return

INI:
IfExist,WindowResizer.ini
{
IniRead,HotkeyLeft,WindowResizer.ini,Settings,HotkeyLeft
IniRead,HotkeyRight,WindowResizer.ini,Settings,HotkeyRight
IniRead,HotkeyUp,WindowResizer.ini,Settings,HotkeyUp
IniRead,HotkeyDown,WindowResizer.ini,Settings,HotkeyDown
IniRead,HotkeyMaximise,WindowResizer.ini,Settings,HotkeyMaximise
}
else
{
IniWrite,^!Left,WindowResizer.ini,Settings,HotkeyLeft
IniWrite,^!Right,WindowResizer.ini,Settings,HotkeyRight
IniWrite,^!Up,WindowResizer.ini,Settings,HotkeyUp
IniWrite,^!Down,WindowResizer.ini,Settings,HotkeyDown
IniWrite,^!1,WindowResizer.ini,Settings,HotkeyMaximise
}
return

TRAYMENU:
Menu, tray, NoStandard
Menu, tray, add, About, ABOUT
Menu, tray, add,
Menu, tray, add, Configure Shortcuts, SETTINGS
Menu, tray, add, Exit, EXIT
Menu, tray, default, About
Menu, tray, Tip,Window Resizer ~ by David Barnes
return

START:
if HotkeyLeft <>
{
Hotkey, IfWinNotActive, ahk_class AutoHotkeyGUI
Hotkey, %HotkeyLeft%, ANCHORLEFT
}
if HotkeyRight <>
{
Hotkey, IfWinNotActive, ahk_class AutoHotkeyGUI
Hotkey, %HotkeyRight%, ANCHORRIGHT
}
if HotkeyUp <>
{
Hotkey, IfWinNotActive, ahk_class AutoHotkeyGUI
Hotkey, %HotkeyUp%, ANCHORUP
}
if HotkeyDown <>
{
Hotkey, IfWinNotActive, ahk_class AutoHotkeyGUI
Hotkey, %HotkeyDown%, ANCHORDOWN
}
if HotkeyMaximise <>
{
Hotkey, IfWinNotActive, ahk_class AutoHotkeyGUI
Hotkey, %HotkeyMaximise%, ANCHORMAXIMISE
}
return

ANCHORLEFT:
WinGetTitle, Window, A
WinMove, %Window%,, 0, 0, A_ScreenWidth/2, A_ScreenHeight-32
return

ANCHORRIGHT:
WinGetTitle, Window, A
WinMove, %Window%,, A_ScreenWidth/2, 0, A_ScreenWidth/2, A_ScreenHeight-32
return

ANCHORUP:
WinGetTitle, Window, A
WinMove, %Window%,, 0, 0, A_ScreenWidth, (A_ScreenHeight-32)/2
return

ANCHORDOWN:
WinGetTitle, Window, A
WinMove, %Window%,, 0, (A_ScreenHeight-32)/2, A_ScreenWidth, (A_ScreenHeight-32)/2
return

ANCHORMAXIMISE:
WinGetTitle, Window, A
WinMove, %Window%,, 0, 0, A_ScreenWidth, A_ScreenHeight-32
return

SETTINGS:
GoSub, INI
Gui, 1: Destroy
Gui, 1: Font, s12, Arial
Gui, 1: Add, Text,,Double click to modify ...
Gui, 1: Add, ListView,h120 gEDITSETTINGS,Function|Hotkey
LV_Add("Select Focus", "Dock Left", HotkeyLeft)
LV_Add("", "Dock Right", HotkeyRight)
LV_Add("", "Dock Top", HotkeyUp)
LV_Add("", "Dock Bottom", HotkeyDown)
LV_Add("", "Maximise Window", HotkeyMaximise)
LV_ModifyCol(1, "AutoHdr")
LV_ModifyCol(2, "AutoHdr")
Gui, 1: Add, Button, default x18 w100 y160 GSAVESETTINGS, OK
Gui, 1: Add, Button, x128 w100 y160 GCANCEL, Cancel
Gui, 1: Show,, Settings
return

EDITSETTINGS:
if A_GuiEvent = DoubleClick
{
LV_GetText(RowText, A_EventInfo)
RowNumber = %A_EventInfo%
Gui, 2: Destroy
Gui, 2: Font, s12, Arial
Gui, 2: Add, Text,,Press new hotkey
Gui, 2: Add, Hotkey, w150 vHotKey
Gui, 2: Add, Button, w150 default GCHANGEHOTKEY, OK
Gui, 2: Show,, %RowText%
}
return

CHANGEHOTKEY:
Gui, 2: Submit
Gui, 1: Default
LV_Modify(RowNumber,"",RowText,Hotkey)
Gui, 2: Destroy
return

SAVESETTINGS:
LV_GetText(HotKeyLeft, 1, 2)
LV_GetText(HotKeyRight, 2, 2)
LV_GetText(HotKeyUp, 3, 2)
LV_GetText(HotKeyDown, 4, 2)
LV_GetText(HotKeyMaximise, 5, 2)

IniWrite,%HotkeyLeft%,WindowResizer.ini,Settings,HotkeyLeft
IniWrite,%HotkeyRight%,WindowResizer.ini,Settings,HotkeyRight
IniWrite,%HotkeyUp%,WindowResizer.ini,Settings,HotkeyUp
IniWrite,%HotkeyDown%,WindowResizer.ini,Settings,HotkeyDown
IniWrite,%HotkeyMaximise%,WindowResizer.ini,Settings,HotkeyMaximise

Gui, 1: Destroy

GoSub, Start
return

CANCEL:
Gui, 1: Destroy
return

EXIT:
ExitApp
return

ABOUT:
Gui, 3: Destroy
Gui, 3: Font, s13 bold, Arial
Gui, 3: Add,text,, Window Resizer
Gui, 3: Font, s11 bold, Arial
Gui, 3: Add,text,xm ym+20,by David Barnes
Gui, 3: Font, s10 norm, Arial
Gui, 3: Add,text,xm ym+50, Dock windows to the left`, right`, top `nand bottom of the screen using `nkeyboard shortcuts.
Gui, 3: Add,text,xm ym+120, Shortcuts customisable via the tray menu
Gui, 3: Add,text,xm ym+150, For more great software, be sure to visit:
Gui, 3: Font, cBlue bold underline
Gui, 3: Add,text,xm ym+170 GSOFTWAREGUIDER, www.softwareguider.110mb.com
Gui, 3: Color, White
Gui, 3: Show,, Windows Resizer
return

SOFTWAREGUIDER:
run, www.softwareguider.110mb.com
return

_________________
Go to http://www.lingokite.com to find out about Lingokite, the revolution in language learning technology


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2009, 11:07 am 
I haven't tried yours yet, but there is already another (excellent) script that came out before Windows 7 ;-)

WindowPad

http://www.autohotkey.com/forum/topic21703.html


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2009, 2:19 pm 
This works well. Is there any way to update it so that when using dual monitors it will dock on the monitor space that the window is currently positioned on? Right now, it moves and docks it to the primary monitor, when the window was originally sitting on the secondary.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2009, 7:31 am 
Offline

Joined: January 25th, 2009, 9:18 pm
Posts: 34
@e1miran
This is possible, however I don't have a dual monitor set up to test the script on. Have a look either on the forum or in the help file and you should find an example.

_________________
Go to http://www.lingokite.com to find out about Lingokite, the revolution in language learning technology


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2009, 7:51 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
SysGet can be used to retrieve the co-ords of each monitor. WindowPad uses it to support multiple monitor setups.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 14 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