Windows Corners
If you use hotkeys to do most things on your Windows OS then you are probably familiar with the Windows movement keys on the number pad (if your keyboard has one). By shutting NumLock off you can then hold down the Windows Key (Windows Logo) and press 2, 4, 6, or 8 (Down, Right, Up, and Left) on the numpad you can move documents and windows to whatever side of the screen in the direction of the arrow on the key. For Left and right (4,6) it strectches the window fullscreen vertically and half screen horizontally and for up it maximizes and down it either pulls you out of maximized states or minimizes.
Today I bring you 'Windows Corners' which provides added functionality to the Windows Key+Numpad combo. By using the numpad keys 1, 3, 7, and 9 (sometimes End, PgDn, PgUp, and Home) you can now move windows to those corresponding corners at a quarter screen! Perfect for analyzing multiple documents or moving lots of projects and files at once.
Usage
Windows Corners is a portable executable that can be placed anywhere and ran by double clicking or from command line like any other binary. Windows corners has no main gui, but runs in the system tray with options for restarting, a help screen, and also an option to run it at computer startup. If it is moved at any time you can fix the auto startup again by simply enabling it in the system tray again. This is an AutoHotkey script compiled for portability, but the script is provided for those who use AHK.
Download
- Windows Corners
- Windows Corners Source Files - AHK Script and Icon
Icon
ScreenShot
Script
; Windows Corners by Lateralus138 AKA Flux Apex AKA Ian Pride OnMessage(0x201,"WM_LBUTTONDOWN") OnMessage(0x200,"WM_MOUSEHOVER") ; Vars vTextLucida := "Windows Corners provides additional window movement keys" . " to the number pad. Normally you" . " can use Windows Key (logo key)" . " +2,4,6, and 8 to move windows" . " to that corresponding direc-" . "`ntion. This application adds" . " these additional keys, hover`nkey to see function." vTextArial := "Windows Corners provides additional window movement keys" . " to the number pad. Normally you" . " can use Windows Key (logo key)" . " +2,4,6, and 8 to move windows" . " to that corresponding direction." . " This application adds" . " these additional keys, hover key to see function." SetWorkingDir, %A_ScriptDir% Global vThsScrpt := A_WorkingDir "\" A_ScriptName, vTxtHghtInit := "20" If IsFont("Lucida Console") Global vFontN := "Lucida Console", vFontS := "13", vTxtMrgnTpA := "4" , vTxtHght := vTxtHghtInit, vTextFinal := vTextLucida, vBxHghtA := "124" , vBxHghtB := "120", vBxHghtC := "156", vBxHghtD := vBxHghtC + 44 , vBttnH := "44" Else Global vFontN := "Arial", vFontS := "12", vTxtMrgnTpA := "3" , vTxtHght := vTxtHghtInit - vTxtMrgnTpA, vTextFinal := vTextArial , vBxHghtA := "102", vBxHghtB := "98", vBxHghtC := "134" , vBxHghtD := vBxHghtC + 36, vBttnH := "36" Global Hide1, Hide2, Hide3, Hide4, Hide5, Hide6, Hide7, Hide8, vHelp, vHelp2, vFontSs := vFontS - 3, vTxtMrgnTpB := vBxHghtC + 4, vBttnHT := vBttnH - 4 ; Menu fncTrayMenu() ; Hotkeys ; Main programs hotkeys ; "A" is for the active window, but this can be changed to ; work only in a specific window by passing any WinTitle ; title such as "ahk_class #32770" or "Notepad" etc... ; A second variable can be passed for Window Text as well: ; E.g. fncMove45("ahk_class #32770","Format") or ; fncMove315("ahk_class #32770","Documents") etc... #NumpadIns::fncHelp() #NumpadDel::fncSplash() #NumpadHome::fncMove315("A") #NumpadEnd::fncMove225("A") #NumpadPgup::fncMove45("A") #NumpadPgdn::fncMove135("A") ; Functions WM_LBUTTONDOWN(){ If MouseOver("0", "0", "440", "24") PostMessage, 0xA1, 2 If MouseOver("240", "7", "250", "17") Gosub, gsExt If MouseOver("582", "7", "592", "17") || MouseOver("422", "7", "432", "17") Gosub, SplashGuiCloseA } WM_MOUSEHOVER(){ global tme DllCall( "TrackMouseEvent","uint",&tme ) If (A_Gui=vHelp) WinActivate If IsFont("Lucida Console") { fncMsOvrBttn("156", "200", "1", "2") fncMsOvrBttn("204", "248", "3", "4") fncMsOvrBttn("252", "296", "5", "6") fncMsOvrBttn("300", "344", "7", "8") } Else { fncMsOvrBttn("134", "170", "1", "2") fncMsOvrBttn("174", "210", "3", "4") fncMsOvrBttn("214", "250", "5", "6") fncMsOvrBttn("254", "290", "7", "8") } } fncMsOvrBttn(vYA, vYB, vHdA, vHdB){ If MouseOver("0", vYA, "85", vYB) { GuiControl, Show, Hide%vHdA% GuiControl, Show, Hide%vHdB% } Else { GuiControl, Hide, Hide%vHdA% GuiControl, Hide, Hide%vHdB% } } MouseOver(_vXa, _vYa, _vXb, _vYb) { MouseGetPos, _vPx, _vPy _vDtct := _vPx >= _vXa AND _vPx <= _vXb AND _vPy >= _vYa AND _vPy <= _vYb Return _vDtct } fncMove45(vTitle,vText := "Default"){ If (vText = "Default") vText = fncGtWrkAr(vWw, vWh,vWwc, vWhc) WinMove, %vTitle%, %vText% ,%vWwc% ,0, %vWwc%, %vWhc% } fncMove135(vTitle,vText := "Default"){ If (vText = "Default") vText = fncGtWrkAr(vWw, vWh,vWwc, vWhc) WinMove, %vTitle%, %vText% ,%vWwc% ,%vWhc%, %vWwc%, %vWhc% } fncMove225(vTitle,vText := "Default"){ If (vText = "Default") vText = fncGtWrkAr(vWw, vWh,vWwc, vWhc) WinMove, %vTitle%, %vText% ,0 ,%vWhc%, %vWwc%, %vWhc% } fncMove315(vTitle,vText := "Default"){ If (vText = "Default") vText = fncGtWrkAr(vWw, vWh,vWwc, vWhc) WinMove, %vTitle%, %vText% ,0 ,0, %vWwc%, %vWhc% } fncGtWrkAr(ByRef vWw, ByRef vWh, ByRef vWwc, ByRef vWhc){ SysGet, vWa, MonitorWorkArea vWw := vWaRight - vWaLeft vWh := vWaBottom - vWaTop vWwc := vWw / 2 vWhc := vWh / 2 } fncChckStrtUp(){ RegRead, vStts, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run, WindowsCorners If !vStts Or !(vStts = vThsScrpt) vStts := "False" Else vStts := "True" Return %vStts% } fncTrayMenu(){ Menu, Tray, DeleteAll Menu, Tray, NoStandard Menu, Tray, Add, &Restart Windows Corners, gsRld vRegCheck := fncChckStrtUp() If (vRegCheck = "False") Menu, Tray, Add, Enable at &startup, gsEnbleStrtp Else Menu, Tray, Add, Disable at &startup, gsDsbleStrtp Menu, Tray, Add, &Help, fncHelp Menu, Tray, Add, &Exit, gsEndAll } fncHelp(){ WinClose, ahk_id %vHelp% Gui, New, +ToolWindow -Caption +HwndvHelp +AlwaysOnTop Gui, Color, EABBAE Gui, Font, s%vFontS% cEED369, %vFontN% Gui, Add, Progress, x0 y0 w260 h24 c083045 BackgroundEED369, 100 Gui, Add, Progress, xp+2 yp+2 w256 h20 c083045 BackgroundEED369, 100 fncXButton("240","7","EED369") Gui, Add, Text, +BackgroundTrans x0 y%vTxtMrgnTpA% w260 h%vTxtHght% Center, Windows Corners Help Gui, Add, Progress, x0 y28 w260 h%vBxHghtA% c083045 BackgroundEED369, 100 Gui, Font, s%vFontSs% cEED369, %vFontN% Gui, Add, Text, +BackgroundTrans x4 y32 w252 h%vBxHghtB% Center, % vTextFinal If IsFont("Lucida Console") { fncButton("156","1","2","Windows`n+NumPad1", "Moves the active window to the lower left") fncButton("204","3","4","Windows`n+NumPad3", "Moves the active window to the lower right") fncButton("252","5","6","Windows`n+NumPad7", "Moves the active window to the upper left") fncButton("300","7","8","Windows`n+NumPad9", "Moves the active window to the upper right") } Else { fncButton("134","1","2","Windows`n+NumPad1", "Moves the active window to the lower left") fncButton("174","3","4","Windows`n+NumPad3", "Moves the active window to the lower right") fncButton("214","5","6","Windows`n+NumPad7", "Moves the active window to the upper left") fncButton("254","7","8","Windows`n+NumPad9", "Moves the active window to the upper right") } Gui, Show, w260 h348, Windows Corners Help WinSet, TransColor, EABBAE, ahk_id %vHelp% } fncSplash(){ WinClose, ahk_id %vHelp2% Gui, Splash: New, +ToolWindow -Caption +HwndvHelp2 +AlwaysOnTop Gui, Splash: Color, EABBAE Gui, Splash: Font, s%vFontS% cEED369, %vFontN% if IsFont("Lucida Console") { vWdth := "600" vMrgn := vWdth - 4 vXB := "582" } Else { vWdth := "440" vMrgn := vWdth - 4 vXB := "422" } Gui, Splash: Add, Progress, x0 y0 w%vWdth% h24 c083045 BackgroundEED369, 100 Gui, Splash: Add, Progress, xp+2 yp+2 w%vMrgn% h20 c083045 BackgroundEED369, 100 Gui, Splash: Add, Text, +BackgroundTrans x0 y%vTxtMrgnTpA% w%vWdth% h%vTxtHght% Center, Please Remember to shut off NumLock for this to work... fncXButton(vXB,"7","EED369") Gui, Splash: Show, w%vWdth% h44, Please Remember to shut off NumLock for this to work... WinSet, TransColor, EABBAE, ahk_id %vHelp2% } fncButton(vBttnY, vHideA, vHideB, vTxtA, vTxtB){ vTxtMrgnTpB := vBttnY + 4 Gui, Add, Progress, x0 y%vBttnY% w85 h%vBttnH% c083045 BackgroundEED369, 100 Gui, Add, Progress, xp+89 y%vBttnY% w171 h%vBttnH% cEED369 Background083045 Hidden vHide%vHideA%, 100 Gui, Add, Text, +BackgroundTrans x0 y%vTxtMrgnTpB% w85 h%vBttnHT% Center, %vTxtA% Gui, Add, Text, +BackgroundTrans xp+89 y%vTxtMrgnTpB% w171 h%vBttnHT% Center Hidden vHide%vHideB% c083045, %vTxtB% } fncXButton(vXInit, vYInit, vClr){ Gui, Add, Progress, x%vXInit% y%vYInit% w2 h2 cEED369 Background%vClr%, 100 Gui, Add, Progress, xP+8 yp w2 h2 c%vClr% Background%vClr%, 100 Gui, Add, Progress, xp-6 yp+2 w2 h2 c%vClr% Background%vClr%, 1007779 Gui, Add, Progress, xp+4 yp w2 h2 c%vClr% Background%vClr%, 100 Gui, Add, Progress, xp-2 yp+2 w2 h2 c%vClr% Background%vClr%, 100 Gui, Add, Progress, xp-2 yp+2 w2 h2 c%vClr% Background%vClr%, 100 Gui, Add, Progress, xp+4 yp w2 h2 c%vClr% Background%vClr%, 100 Gui, Add, Progress, xp-6 yp+2 w2 h2 c%vClr% Background%vClr%, 100 Gui, Add, Progress, xp+8 yP w2 h2 c%vClr% Background%vClr%, 100 } IsFont(FontName){ Loop, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts { If (RegExMatch(A_LoopRegName, "^" . FontName . " \(") > 0) Return 1 } Return 0 } ; Gosubs gsSplashOff: Gui, Splash: Destroy Return gsRld: Reload Return gsEnbleStrtp: RegWrite, REG_SZ, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run, WindowsCorners, % vThsScrpt fncTrayMenu() Return gsDsbleStrtp: RegDelete, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run, WindowsCorners fncTrayMenu() Return SplashGuiCloseA: SplashGuiClose: SplashGuiEscape: Gui, Splash: Destroy Return GuiClose: GuiEscape: gsExt: Gui, Destroy SetTimer, gsSplashOff, 3000 fncSplash() Return gsEndAll: ExitApp
No comments:
Post a Comment