diff --git a/.gitmodules b/.gitmodules index 49c393c..ad0de61 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "Utilities/Colorette"] path = Utilities/Colorette url = https://github.com/Appifyer/Colorette.git +[submodule "Utilities/WindowPadX"] + path = Utilities/WindowPadX + url = https://github.com/denolfe/WindowPadX diff --git a/Home.ahk b/Home.ahk index 7b37f34..e96f574 100644 --- a/Home.ahk +++ b/Home.ahk @@ -12,8 +12,7 @@ SetCapsLockState, AlwaysOff RunIfExist(A_ScriptDir "\VolumeScroll\VolumeScroll.ahk") RunIfExist(A_ScriptDir "\AutoCorrect.ahk") -FileCopy, %A_ScriptDir%\WindowPadX\WindowPadX-home.ini, %A_ScriptDir%\WindowPadX\WindowPadX.ini, 1 -RunIfExist(A_ScriptDir "\WindowPadX\WindowPadX.ahk") +RunIfExist(A_ScriptDir "Utilities\WindowPadX\WindowPadX.ahk .\WindowPadX.ini") RunIfExist(A_ScriptDir "\AutoCorrect.ahk") IfWinNotExist, ahk_exe clipx.exe diff --git a/Utilities/WindowPadX b/Utilities/WindowPadX new file mode 160000 index 0000000..933b8c6 --- /dev/null +++ b/Utilities/WindowPadX @@ -0,0 +1 @@ +Subproject commit 933b8c6238794e9ed7c1ff92edbc985f0899a562 diff --git a/WindowPadX/.gitignore b/WindowPadX/.gitignore deleted file mode 100644 index 79e714c..0000000 --- a/WindowPadX/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.exe -*.bak -/_SOURCES_ \ No newline at end of file diff --git a/WindowPadX/Doc-Adding_Commands.txt b/WindowPadX/Doc-Adding_Commands.txt deleted file mode 100644 index bb852e3..0000000 --- a/WindowPadX/Doc-Adding_Commands.txt +++ /dev/null @@ -1,14 +0,0 @@ -About: Adding Commands - -Additional commands for use in *WindowPadX.ini* may be implemented by simply adding subroutines or functions to *WPXA.ahk*. For instance, a Close command could be implemented by adding either of the following - ->WPXA_Close(winTitle) { -> if wp_WinExist(winTitle) -> WinClose ->} - -It would then be used like any other *WindowPadX* command from , by adding something like this to WindowPadX.ini - ->!4 = WPXA_Close, A - -Note that *AutoHotkey* is required to run *WindowPadX.ahk* after making changes. To get an executable version of *WindowPadX* you might want to use *Ahk2Exe* \ No newline at end of file diff --git a/WindowPadX/Doc-Commandline_Usage.txt b/WindowPadX/Doc-Commandline_Usage.txt deleted file mode 100644 index 8778d5c..0000000 --- a/WindowPadX/Doc-Commandline_Usage.txt +++ /dev/null @@ -1,9 +0,0 @@ -About: Command-line Usage - -*WindowPadX* supports a command-line mode. Simply pass one or more commands from the command-line and *WindowPadX* will execute them and then exit. If a command's parameters contain spaces, the command and its arguments must be enclosed in quotation marks. For example - -> WindowPadX.exe GatherWindows,1 "WindowScreenMove, Next, My Window" - -Available commands are described within . - -*Hint*: To get an executable version of *WindowPadX* you might want to use *Ahk2Exe* diff --git a/WindowPadX/Readme.md b/WindowPadX/Readme.md deleted file mode 100644 index b929e1a..0000000 --- a/WindowPadX/Readme.md +++ /dev/null @@ -1,36 +0,0 @@ -WindowPadX -========== - -Detailed Documentation can be found here: http://hoppfrosch.github.com/WindowPadX/files/WindowPadX-ahk.html - -Introduction ------------- - -***WindowPadX*** is an enhancement of ***WindowPad***, originally released by Lexikos (see: http://http://www.autohotkey.com/forum/viewtopic.php?t=21703) - -***WindowPadX*** is a tool which provides some useful functionality within multi monitor environments. - -Features --------- -- Possible actions to be configured on hotkeys - - Window actions - - Multi-Monitor - - WPXA_MoveWindowToMonitor: Move window between screens, preserving relative position and size. - - WPXA_MinimizeWindowsOnMonitor: Minimize all windows on the given Screen - - WPXA_GatherWindowsOnMonitor: "Gather" windows on a specific screen. - - WPXA_FillVirtualScreen: Expand the window to fill the virtual screen (all monitors). - - General - - WPXA_MaximizeToggle: Maximize or restore the window. - - WPXA_TopToggle: Toogles "AlwaysOnTop" for given window - - WPXA_RollToggle: Toggles "Roll/Unroll" for given window - - WPXA_Move: move and resize window based on a "pad" concept. - - WPXA_TileLast2Windows: Tile active and last window - - Mouse actions - - Multi-Monitor - - WPXA_MoveMouseToMonitor: Moves mouse to center of given monitor - - WPXA_ClipCursorToCurrentMonitorToggle: Toogles clipping mouse to current monitor - - WPXA_ClipCursorToMonitor: Clips (Restricts) mouse to given monitor - - General - - WPXA_MouseLocator: Easy find the mouse - -For more details see http://hoppfrosch.github.com/WindowPadX/files/WindowPadX-ahk.html \ No newline at end of file diff --git a/WindowPadX/WPXA.ahk b/WindowPadX/WPXA.ahk deleted file mode 100644 index d4563d4..0000000 --- a/WindowPadX/WPXA.ahk +++ /dev/null @@ -1,1496 +0,0 @@ -/* - Title: WindowPadX-Actions library - Implementation of different useful actions for handling windows in general and within a multi-monitor setup in special. - - Functions starting with the prefix *WPXA* are designed to be used as user-actions within *WindowPadX*, whereas functions starting with the prefix *wp* are internal helper functions. - - Author: - hoppfrosch - - License: - WTFPL (http://sam.zoy.org/wtfpl/) - - Credits: - Lexikos - for his great work and his Original *WindowPad - multi-monitor window-moving tool* (http://www.autohotkey.com/forum/topic21703.html) - ShinyWong - for his *GetMonitorIndexFromWindow* function (http://www.autohotkey.com/forum/viewtopic.php?p=462080#462080) - used in - Skrommel - for his *MouseMark* function (http://www.donationcoder.com/Software/Skrommel/MouseMark/MouseMark.ahk) - used in - x97animal - for his *clipCursor* Function (http://www.autohotkey.com/forum/viewtopic.php?p=409537#409537) - used in - ipstone today - for his initial implementation (http://www.autohotkey.com/forum/viewtopic.php?p=521482#521482) for - Sean - for his *WinTrayMin* functionality (http://http://www.autohotkey.com/community/viewtopic.php?f=2&t=33263) - used in - gwarble - for his great *Notify* function (http://www.autohotkey.com/community/viewtopic.php?f=2&t=48668) - - Changelog: - 0.2.0 - [-] Removed - [-] Removed - [+] : Toggles Roll/Unroll State of window. (Corrected behaviour after manually resizing a previously rolled window) - [*] Adapted to use wp_RollWindowToggle - 0.1.12 - [*] Internal Changes: Update to Notify 0.499 (http://www.autohotkey.com/community/viewtopic.php?f=2&t=48668), Introduced Global variables for easier configuration ... - 0.1.11 - [+] : Minimize a window to a tray icon (see: http://http://www.autohotkey.com/community/viewtopic.php?f=2&t=33263 - thanks to Sean) - {+] : Mininmize a window to a tray icon (see ) - 0.1.10 - [+] : Determines monitor from current mouseposition. - [*] : added minimization of all windows on screen where mouse is. - 0.1.9 - [+] : Tile active and last window (see: http://www.autohotkey.com/forum/viewtopic.php?p=521482#521482 - thanks to ipstone today). - 0.1.8 - [*] : Bugfix to actually toggle Maximization (see: http://www.autohotkey.com/forum/post-508122.html#508122 - thanks to sjkeegs). - 0.1.7 - [+] : Toggles Roll/Unroll State of window. - [+] : Rolls up a window to its titlebar. - [+] : Unrolls a previously rolled up window (restores original height). - 0.1.6 - [*] : Reanimated Notification (removed Parameter ShowNotification). - [*] Extended Debug-Logging via OutputDebug. (Unified Output format, Created posibillity to remove debug information (via Tag _DBG_)). - 0.1.5 - [-] : Using integer coordinates for Gui Show. -*/ - -; ****** HINT: Documentation can be extracted to HTML using NaturalDocs ************** */ - -; Global Varibles -Version := "0.2.0" - -NotifyOptions := "GC=303030 TC=FFFFFF TS=8 TF=Verdana MC=FFFFFF MF=Verdana SI=200 ST=200 SC=200 BK=White IW=16 IH=16 Image=" -NotifyDuration := 3 -Ico_Dir := A_ScriptDir "/icons" -Ico_Minus := Ico_Dir "/minus.png" -Ico_Plus := Ico_Dir "/plus.png" - -/* -=============================================================================== -Function: WPXA_version - Returns the current version of WPXA - - Versioning scheme according to http://semver.org - -Returns: - current version number of the module - -Author(s): - 20110713 - hoppfrosch - Original -=============================================================================== -*/ -WPXA_version() -{ - Global Version - - return Version -} - -/* -=============================================================================== -Function: wp_ClipCursor - Clips (restricts/confines) the mouse to a given area - -Parameters: - Confine - Toogle for Clipping - x1,y1,x2,y2 - Bounding coordinates (upper left, lower right) of confined area - -Returns: - If the function succeeds, the return value is nonzero. - If the function fails, the return value is zero. To get extended error information, call GetLastError. - -Author(s): - Original - x79animal - http://www.autohotkey.com/forum/viewtopic.php?p=409537#409537 - 20110127 - hoppfrosch - Modifications -=============================================================================== -*/ -wp_ClipCursor( Confine=True, x1=0 , y1=0, x2=1, y2=1 ) -{ - VarSetCapacity(R,16,0), NumPut(x1,&R+0),NumPut(y1,&R+4),NumPut(x2,&R+8),NumPut(y2,&R+12) - Return Confine ? DllCall( "ClipCursor", UInt,&R ) : DllCall( "ClipCursor" ) -} - -/* -=============================================================================== -Function: wp_GetMonitorAt - Get the index of the monitor containing the specified x and y coordinates. - -Parameters: - x,y - Coordinates - default - Default monitor - -Returns: - Index of the monitor at specified coordinates - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_GetMonitorAt(x, y, default=1) -{ - SysGet, m, MonitorCount - ; Iterate through all monitors. - Loop, %m% - { ; Check if the window is on this monitor. - SysGet, Mon, Monitor, %A_Index% - if (x >= MonLeft && x <= MonRight && y >= MonTop && y <= MonBottom) - return A_Index - } - - return default -} - -/* -=============================================================================== -Function: wp_GetMonitorFromMouse - Get the index of the monitor where the mouse is - -Parameters: - default - Default monitor - -Returns: - Index of the monitor where the mouse is - -Author(s): - 20120322- hoppfrosch: Initial -=============================================================================== -*/ -wp_GetMonitorFromMouse(default=1) -{ - MouseGetPos,x,y - return wp_GetMonitorAt(x,y,default) -} - -/* -=============================================================================== -Function: wp_GetMonitorFromWindow - Get the index of the monitor containing the specified window. - -Parameters: - hWnd - Window handle - -Returns: - Index of the monitor of specified window - -Author(s): - Original - ShinyWong - http://www.autohotkey.com/forum/viewtopic.php?p=462080#462080 -=============================================================================== -*/ -wp_GetMonitorFromWindow(hWnd) -{ - ; Starts with 1. - monitorIndex := 1 - - VarSetCapacity(monitorInfo, 40) - NumPut(40, monitorInfo) - - if (monitorHandle := DllCall("MonitorFromWindow", "uint", hWnd, "uint", 0x2)) - && DllCall("GetMonitorInfo", "uint", monitorHandle, "uint", &monitorInfo) - { - monitorLeft := NumGet(monitorInfo, 4, "Int") - monitorTop := NumGet(monitorInfo, 8, "Int") - monitorRight := NumGet(monitorInfo, 12, "Int") - monitorBottom := NumGet(monitorInfo, 16, "Int") - workLeft := NumGet(monitorInfo, 20, "Int") - workTop := NumGet(monitorInfo, 24, "Int") - workRight := NumGet(monitorInfo, 28, "Int") - workBottom := NumGet(monitorInfo, 32, "Int") - isPrimary := NumGet(monitorInfo, 36, "Int") & 1 - - SysGet, monitorCount, MonitorCount - - Loop, %monitorCount% - { - SysGet, tempMon, Monitor, %A_Index% - - ; Compare location to determine the monitor index. - if ((monitorLeft = tempMonLeft) and (monitorTop = tempMonTop) - and (monitorRight = tempMonRight) and (monitorBottom = tempMonBottom)) - { - monitorIndex := A_Index - break - } - } - } - - return %monitorIndex% -} - - -/* -=============================================================================== -Function: wp_GetProp - Get window property. - -Parameters: - hwnd - Window handle - property_name - Name of the property - type - Type of the property - should be int, uint or float. - -Returns: - Value of the property, otherwise NULL if property does not exist - -See also: - , - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html - Reference - MSDN - http://msdn.microsoft.com/en-us/library/ms633564%28v=vs.85%29.aspx -=============================================================================== -*/ -wp_GetProp(hwnd, property_name, type="int") { - return DllCall("GetProp", "uint", hwnd, "str", property_name, type) -} - -/* -=============================================================================== -Function: wp_IsAlwaysOnTop - Determine whether fiven window is set to always on top - -Parameters: - WinTitle - Title of the window - IsSetByWP - Checks whether "AlwaysOnTop" was set with WindowPadX (needed to restore state ...) - -Returns: - True or False - -Author(s): - 20110811 - hoppfrosch - Initial -=============================================================================== -*/ -wp_IsAlwaysOnTop(WinTitle,IsSetByWP=0) -{ - WinGet, CurrExStyle, ExStyle, %WinTitle% - - if hwnd := wp_WinExist(WinTitle) { - if (IsSetByWP=1) - { - if wp_GetProp(hwnd,"wpAlwaysOnTop") - { - return (CurrExStyle & 0x08) ; WS_EX_TOPMOST - } - else - { - return 0 - } - } - return (CurrExStyle & 0x08) ; WS_EX_TOPMOST - } - - return -} - -/* -=============================================================================== -Function: wp_IsResizable - Determine if we should attempt to resize the last found window. - -Returns: - True or False - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_IsResizable() -{ - WinGetClass, Class - if Class in Chrome_XPFrame,MozillaUIWindowClass - return true - WinGet, CurrStyle, Style - return (CurrStyle & 0x40000) ; WS_SIZEBOX -} - -/* -=============================================================================== -Function: wp_IsWhereWePutIt - Restores windows position and size previously stored with - -Parameters: - hwnd - Window handle - -Returns: - x,y,w,h - last position and size - -See also: - - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_IsWhereWePutIt(hwnd, x, y, w, h) -{ - if wp_GetProp(hwnd,"wpHasRestorePos") - { ; Window has restore info. Check if it is where we last put it. - last_x := wp_GetProp(hwnd,"wpLastX") - last_y := wp_GetProp(hwnd,"wpLastY") - last_w := wp_GetProp(hwnd,"wpLastW") - last_h := wp_GetProp(hwnd,"wpLastH") - return (last_x = x && last_y = y && last_w = w && last_h = h) - } - return false -} - -/* -=============================================================================== -Function: wp_RememberPos - Helper function for detection of window movement by user. Stores the current position. The stored position can be recovered by - -Parameters: - hwnd - Window handle - -See also: - , - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_RememberPos(hwnd) -{ - WinGetPos, x, y, w, h, ahk_id %hwnd% - ; Remember where we put it, to detect if the user moves it. - wp_SetProp(hwnd,"wpLastX",x) - wp_SetProp(hwnd,"wpLastY",y) - wp_SetProp(hwnd,"wpLastW",w) - wp_SetProp(hwnd,"wpLastH",h) -} - -/* -=============================================================================== -Function: wp_RemoveProp - Remove window property. - -Parameters: - hwnd - Window handle - property_name - Name of the property - -Returns: - Handle - The return value identifies the specified data. If the data cannot be found in the specified property list, the return value is NULL. - -See also: - , - -Author(s): - Reference - MSDN (http://msdn.microsoft.com/en-us/library/ms633567%28v=vs.85%29.aspx) - 20110713 - hoppfrosch - AutoHotkey-Implementation -=============================================================================== -*/ -wp_RemoveProp(hwnd, property_name) { - - _DBG_FName := A_ScriptName "-[wp_RemoveProp] - " ; _DBG_ - WinGetClass, WinClass, ahk_id %hwnd% ; _DBG_ - WinGetTitle, WinTitle, ahk_id %hwnd% ; _DBG_ - OutputDebug % _DBG_FName "Remove Property <" property_name "> for hwnd: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - - return DllCall("RemoveProp", "uint", hwnd, "str", property_name) -} - -/* -=============================================================================== -Function: wp_Restore - Restores windows to state according properties - - Following states are restored: - * AlwaysOnTop - * RolledWindow - -Author(s): - 20110713 - hoppfrosch - AutoHotkey-Implementation -=============================================================================== -*/ -wp_Restore() { - ;MsgBox % "wp_Restore(): Vollstaendige Implementierung" - _DBG_FName := A_ScriptName "-[wp_Restore] - " ; _DBG_ - - WinGet, id, list, , , Program Manager - Loop, %id% - { - ; Aktionen r�ckh�ngig ... - hwnd := id%A_Index% - WinGetTitle, WinTitle, ahk_id %hwnd% - - WinGetClass, WinClass, ahk_id %hwnd% ; _DBG_ - OutputDebug % _DBG_FName "Besuche Fenster <" a_index "/" id ">: ahk_id: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - - if wp_GetProp(hwnd,"wpAlwaysOnTop") { - OutputDebug % _DBG_FName "Window <" WinTitle "> has property " ; _DBG_ - if wp_IsAlwaysOnTop(WinTitle,1) { - OutputDebug % _DBG_FName "Disable AlwaysOnTop since it was set by WindowPadX" ; _DBG_ - WPXA_TopToggle(WinTitle) - OutputDebug % _DBG_FName "Current State of AlwaysOnTop: " wp_IsAlwaysOnTop(WinTitle) ; _DBG_ - } - } - else if (wp_GetProp(hwnd,"wpHasRestorePos")) { - OutputDebug % _DBG_FName "Window <" WinTitle "> has property " ; _DBG_ - } - else if (wp_GetProp(hwnd,"wpRolledUp") = 1) - { - OutputDebug % _DBG_FName "RollWindow disabled for hwnd: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - wp_RollWindowToggle(hwnd) - } - - - } -} - -/* -=============================================================================== -Function: wp_RollWindowToggle - Toggles Rollup of a window (Rollup to caption bar) - -Parameters: - hWnd - Window handle - -Author(s): - 20120620 - hoppfrosch - Original -=============================================================================== -*/ -wp_RollWindowToggle(hwnd) -{ - _DBG_FName := A_ScriptName "-[wp_RollWindowToggle] - " ; _DBG_ - WinGetClass, WinClass, ahk_id %hwnd% ; _DBG_ - WinGetTitle, WinTitle, ahk_id %hwnd% ; _DBG_ - - ; Determine the minmal height of a window - SysGet, MinWinHeight, 29 - ; Get size of current window - WinGetPos, x, y, width, height, ahk_id %hwnd% - OutputDebug % _DBG_FName "MinWinHeight: " MinWinHeight " - win_height: " height " - wpRolledUp: " wp_GetProp(hwnd,"wpRolledUp") ; _DBG_ - - if (wp_GetProp(hwnd,"wpRolledUp") = 1) - { - if (height = MinWinHeight) - { - ; The window is still rolled up - heightUnrolled := wp_GetProp(hwnd,"wpUnrolledHeight") - WinMove, ahk_id %hwnd%, , , , ,%heightUnrolled% - wp_SetProp(hwnd,"wpRolledUp", 0) - wp_RemoveProp(hwnd,"wpUnrolledHeight") - OutputDebug % _DBG_FName "RollWindow disabled for hwnd: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - } - else - { - ; the previously rolled-up window was unrolled manually - so rollup it again - wp_SetProp(hwnd,"wpRolledUp",1) - wp_SetProp(hwnd,"wpUnrolledHeight",height) - WinMove, ahk_id %hwnd%, , , , ,%MinWinHeight% - OutputDebug % _DBG_FName "RollWindow enabled for hwnd: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - } - } - else - { - if (height > MinWinHeight) - { - wp_SetProp(hwnd,"wpRolledUp",1) - wp_SetProp(hwnd,"wpUnrolledHeight",height) - WinMove, ahk_id %hwnd%, , , , ,%MinWinHeight% - OutputDebug % _DBG_FName "RollWindow enabled for hwnd: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - } - } - return wp_GetProp(hwnd,"wpRolledUp") -} - -/* -=============================================================================== -Function: wp_SetProp - Set window property. - -Parameters: - hwnd - Window handle - property_name - Name of the property - data - Value of the property - type - Type of the property - should be int, uint or float - -Returns: - True or False - -See also: - , - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_SetProp(hwnd, property_name, data, type="int") { - _DBG_FName := A_ScriptName "-[wp_SetProp] - " ; _DBG_ - WinGetClass, WinClass, ahk_id %hwnd% ; _DBG_ - WinGetTitle, WinTitle, ahk_id %hwnd% ; _DBG_ - OutputDebug % _DBG_FName "Set Property <" property_name "> to data <" data "> for hwnd: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - return DllCall("SetProp", "uint", hwnd, "str", property_name, type, data) -} - -/* -=============================================================================== -Function: wp_SetRestorePos - Stores windows position for restoring it later - -Parameters: - hwnd - Window handle - x,y,w,h - Next time user requests the window be "restored" use this position and size. - -See also: - - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_SetRestorePos(hwnd, x, y, w, h) -{ - ; Next time user requests the window be "restored" use this position and size. - wp_SetProp(hwnd,"wpHasRestorePos",true) - wp_SetProp(hwnd,"wpRestoreX",x) - wp_SetProp(hwnd,"wpRestoreY",y) - wp_SetProp(hwnd,"wpRestoreW",w) - wp_SetProp(hwnd,"wpRestoreH",h) -} - -/* -=============================================================================== -Function: wp_WinExist - Custom WinExist() for implementing a couple extra "special" values. - -Parameters: - WinTitle - Title of the window - -Returns: - Windowshandle - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_WinExist(WinTitle) -{ - if WinTitle = P - return wp_WinPreviouslyActive() - if WinTitle = M - { - MouseGetPos,,, win - return WinExist("ahk_id " win) - } - if WinTitle = _ - return wp_WinLastMinimized() - return WinExist(WinTitle!="" ? WinTitle : "A") -} - -/* -=============================================================================== -Function: wp_WinGetTitle - Custom WinGetTitle() for getting either title of "last found" window or window given by title - -Parameters: - WinTitle - Title of the window - -Returns: - WinTitle - Title of the window - -Author(s): - 20110607 - hoppfrosch - Original -=============================================================================== -*/ -wp_WinGetTitle(WinTitle) -{ - if WinTitle = - WinGetTitle, CurrWinTitle, - else - WinGetTitle, CurrWinTitle,WinTitle - - return CurrWinTitle -} - -/* -=============================================================================== -Function: wp_WinLastMinimized - Get most recently minimized window. - -Returns: - True or false - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_WinLastMinimized() -{ - WinGet, w, List - - Loop %w% - { - wi := w%A_Index% - WinGet, m, MinMax, ahk_id %wi% - if m = -1 ; minimized - { - lastFound := wi - break - } - } - - return WinExist("ahk_id " . (lastFound ? lastFound : 0)) -} - -/* -=============================================================================== -Function: wp_WinPreviouslyActive - Get next window beneath the active one in the z-order. - -Returns: - Windowshandle - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -wp_WinPreviouslyActive() -{ - active := WinActive("A") - WinGet, win, List - - ; Find the active window. - ; (Might not be win1 if there are always-on-top windows?) - Loop, %win% - if (win%A_Index% = active) - { - if (A_Index < win) - N := A_Index+1 - - ; hack for PSPad: +1 seems to get the document (child!) window, so do +2 - ifWinActive, ahk_class TfPSPad - N += 1 - - break - } - - ; Use WinExist to set Last Found Window (for consistency with WinActive()) - return WinExist("ahk_id " . win%N%) -} - -/* -=============================================================================== -Function: wp_WinTraymin - Minimizes a window to a tray icon. - -Parameters: - hWnd - Windows-Handle - nFlags - Flag to allow manipulate properites: - wp_WinTraymin(hWnd,0), where 0 can be omitted. - Removing all trayminned trayicons: wp_WinTraymin(0,-1). - Other values than 0 & -1 are reserved for internal use. - -Author(s): - Original - Sean - http://http://www.autohotkey.com/community/viewtopic.php?f=2&t=33263 -=============================================================================== -*/ -wp_WinTraymin(hWnd = "", nFlags = "") -{ - Static - If Not hAHK&&hAHK:=WinExist("ahk_class AutoHotkey ahk_pid " DllCall("GetCurrentProcessId")) - ShellHook:=DllCall("RegisterWindowMessage","Str","SHELLHOOK"), nIcons:=0 - , DllCall("RegisterShellHookWindow","Uint",hAHK) - , OnMessage(nMsg:=1028,"WM_SHELLHOOKMESSAGE") - If Not nFlags - { - If Not ((hWnd+=0)||hWnd:=DllCall("GetForegroundWindow"))||((h:=DllCall("GetWindow","Uint",hWnd,"Uint",4))&&DllCall("IsWindowVisible","Uint",h)&&!hWnd:=h)|| - !(VarSetCapacity(sClass,32),DllCall("GetClassName","Uint",hWnd,"Str",sClass,"Uint",VarSetCapacity(sClass)//2))||sClass=="Shell_TrayWnd"||sClass=="Progman" - { - Return - } - OnMessage(ShellHook,"") - WinMinimize, ahk_id %hWnd% - WinHide, ahk_id %hWnd% - Sleep, 100 - OnMessage(ShellHook,"WM_SHELLHOOKMESSAGE") - uID:=uID_%hWnd%, uID ? "" : (uID_%hWnd%:=uID:=++nIcons=nMsg ? ++nIcons : nIcons) - SendMessage, 0x7F, 2, 0,, ahk_id %hWnd% - If Not hIcon:=ErrorLevel - { - hIcon:=DllCall("GetClassLong","Uint",hWnd,"Int",-34) - } - DllCall("GetWindowTextA","Uint",hWnd,"Uint",NumPut(hIcon,NumPut(nMsg,NumPut(1|2|4,NumPut(uID,NumPut(hAHK,NumPut(VarSetCapacity(ni,152),ni)))))),"int",128) - Return hWnd_%uID%:=DllCall("shell32\Shell_NotifyIcon","Uint",hWnd_%uID% ? 1 : 0,"Uint",&ni) ? hWnd : DllCall("ShowWindow","Uint",hWnd,"int",5)*0, DllCall("DestroyIcon","Uint",hIcon) - } - Else If nFlags > 0 - { - If (nFlags=3&&uID:=hWnd) - If WinExist("ahk_id " . hWnd:=hWnd_%uID%) - { - WinShow, ahk_id %hWnd% - WinRestore, ahk_id %hWnd% - } - Else nFlags:=2 - Else uID:=uID_%hWnd% - Return uID&&hWnd_%uID% ? (DllCall("shell32\Shell_NotifyIcon","Uint",2,"Uint",NumPut(uID,NumPut(hAHK,NumPut(VarSetCapacity(ni,152),ni)))-12),hWnd_%uID%:="") : "" - } - Else - Loop, % nIcons+0*DllCall("DeregisterShellHookWindow","Uint",hAHK) - hWnd_%A_Index% ? (DllCall("shell32\Shell_NotifyIcon","Uint",2,"Uint",NumPut(A_Index,NumPut(hAHK,NumPut(VarSetCapacity(ni,152),ni)))-12),DllCall("ShowWindow","Uint",hWnd_%A_Index%,"int",5),hWnd_%A_Index%:="") : "" -} - -/* -=============================================================================== -Function: WPXA_ClipCursorToMonitor - Clips (Restricts) mouse to given monitor - -Parameters: - md - monitor-id - -Author(s): - 20110126 - hoppfrosch - Initial -=============================================================================== -*/ -WPXA_ClipCursorToMonitor(md) -{ - SysGet, mc, MonitorCount - if (md<0 or md>mc) - return - - if (md=0) - { - wp_ClipCursor( False,0,0,1,1) ; Turn clipping off - return - } - - Loop, %mc% - SysGet, mon%A_Index%, MonitorWorkArea, %A_Index% - - ; Destination monitor - mdx1 := mon%md%Left - mdy1 := mon%md%Top - mdx2 := mon%md%Right - mdy2 := mon%md%Bottom - - wp_ClipCursor(True,mdx1,mdy1,mdx2,mdy2) - } - -/* -=============================================================================== -Function: WPXA_ClipCursorToCurrentMonitorToggle - Toogles clipping mouse to current monitor - -Author(s): - 20110126 - hoppfrosch - Initial -=============================================================================== -*/ -WPXA_ClipCursorToCurrentMonitorToggle() -{ - Static IsLocked - - if (IsLocked=True) - { - wp_ClipCursor( False ) ; Turn clipping off - IsLocked:=False - } - else - { - CoordMode, Mouse, Screen - MouseGetPos, xpos, ypos - md := wp_GetMonitorAt(xpos, ypos, 0) - - SysGet, mc, MonitorCount - Loop, %mc% - SysGet, mon%A_Index%, MonitorWorkArea, %A_Index% - - ; Destination monitor - mdx1 := mon%md%Left - mdy1 := mon%md%Top - mdx2 := mon%md%Right - mdy2 := mon%md%Bottom - - wp_ClipCursor(True,mdx1,mdy1,mdx2,mdy2) - IsLocked := True - } -} - -/* -=============================================================================== -Function: WPXA_FillVirtualScreen - Expand the window to fill the virtual screen (all monitors). - -Parameters: - winTitle - windows title - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -WPXA_FillVirtualScreen(winTitle) -{ - if hwnd := wp_WinExist(winTitle) - { - WinGetPos, x, y, w, h - if !wp_IsWhereWePutIt(hwnd, x, y, w, h) - wp_SetRestorePos(hwnd, x, y, w, h) - ; Get position and size of virtual screen. - SysGet, x, 76 - SysGet, y, 77 - SysGet, w, 78 - SysGet, h, 79 - ; Resize window to fill all... - WinMove,,, x, y, w, h - wp_RememberPos(hwnd) - } -} - -/* -=============================================================================== -Function: WPXA_GatherWindowsOnMonitor - "Gather" windows on a specific screen. - -Parameters: - md - monitor id - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -WPXA_GatherWindowsOnMonitor(md) -{ - global ProcessGatherExcludeList - - SetWinDelay, 0 - - ; List all visible windows. - WinGet, win, List - - ; Copy bounds of all monitors to an array. - SysGet, mc, MonitorCount - Loop, %mc% - SysGet, mon%A_Index%, MonitorWorkArea, %A_Index% - - if md = M - { ; Special exception for 'M', since the desktop window - ; spreads across all screens. - CoordMode, Mouse, Screen - MouseGetPos, x, y - md := wp_GetMonitorAt(x, y, 0) - } - else if md is not integer - { ; Support A, P and WinTitle. - ; (Gather at screen containing specified window.) - wp_WinExist(md) - WinGetPos, x, y, w, h - md := wp_GetMonitorAt(x+w/2, y+h/2, 0) - } - if (md<1 or md>mc) - return - - ; Destination monitor - mdx := mon%md%Left - mdy := mon%md%Top - mdw := mon%md%Right - mdx - mdh := mon%md%Bottom - mdy - - Loop, %win% - { - ; If this window matches the GatherExclude group, don't touch it. - if (WinExist("ahk_group GatherExclude ahk_id " . win%A_Index%)) - continue - - ; Set Last Found Window. - if (!WinExist("ahk_id " . win%A_Index%)) - continue - - WinGet, procname, ProcessName - ; Check process (program) exclusion list. - if procname in %ProcessGatherExcludeList% - continue - - WinGetPos, x, y, w, h - - ; Determine which monitor this window is on. - xc := x+w/2, yc := y+h/2 - ms := 0 - Loop, %mc% - if (xc >= mon%A_Index%Left && xc <= mon%A_Index%Right - && yc >= mon%A_Index%Top && yc <= mon%A_Index%Bottom) - { - ms := A_Index - break - } - ; If already on destination monitor, skip this window. - if (ms = md) - continue - - WinGet, state, MinMax - if (state = 1) { - WinRestore - WinGetPos, x, y, w, h - } - - if ms - { - ; Source monitor - msx := mon%ms%Left - msy := mon%ms%Top - msw := mon%ms%Right - msx - msh := mon%ms%Bottom - msy - - ; If the window is resizable, scale it by the monitors' resolution difference. - if (wp_IsResizable()) { - w *= (mdw/msw) - h *= (mdh/msh) - } - - ; Move window, using resolution difference to scale co-ordinates. - WinMove,,, mdx + (x-msx)*(mdw/msw), mdy + (y-msy)*(mdh/msh), w, h - } - else - { ; Window not on any monitor, move it to center. - WinMove,,, mdx + (mdw-w)/2, mdy + (mdh-h)/2 - } - - if state = 1 - WinMaximize - } -} - -/* -=============================================================================== -Function: WPXA_MaximizeToggle - Maximize or restore the window. - -Parameters: - winTitle - windows title - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -WPXA_MaximizeToggle(winTitle) -{ - if hwnd := wp_WinExist(winTitle) - { - WinGetPos, x, y, w, h - if !wp_IsWhereWePutIt(hwnd, x, y, w, h) - { - ; WindowPadX didn't put that window here, so save this position before moving. - wp_SetRestorePos(hwnd, x, y, w, h) - } - - WinGet, state, MinMax - if state - WinRestore - else - WinMaximize - - wp_RememberPos(hwnd) - } -} - -/* -=============================================================================== -Function: WPXA_MinimizeWindowsOnMonitor - Minimize all windows on the given Screen or all windows on screen where where the mouse currently lives - -Parameters: - md - monitor-id, if 0 determine monitor from mouse pos - -Author(s): - 20110125 - hoppfrosch - Initial - 20120322 - hoppfrosch - minimize windows on screen where mouse is (md = 0) -=============================================================================== -*/ -WPXA_MinimizeWindowsOnMonitor(md) -{ - ; If md=0: determine monitor from mouse ... - if (md=0) { - md := wp_GetMonitorFromMouse() - } - SysGet, mc, MonitorCount - if (md<1 or md>mc) - return - - ; List all visible windows. - WinGet, win, List - Loop, %win% - { - this_id := win%A_Index% - WinGetTitle, this_title, ahk_id %this_id% - WinGetPos, x, y, w, h, %this_title% - ; Determine which monitor this window is on. - xc := x+w/2, yc := y+h/2 - mcurr := wp_GetMonitorAt(xc, yc, 0) - - if (mcurr=md) - { - WinMinimize, %this_title% - } - } -} - -/* -=============================================================================== -Function: WPXA_Move - move and resize window based on a "pad" concept. - -Parameters: - sideX, sideY, widthFactor, heightFactor - **TODO** - winTitle - windows title ("A" - Active Window, "P" - Previous Window) - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -WPXA_Move(sideX, sideY, widthFactor, heightFactor, winTitle) -{ - if ! hwnd := wp_WinExist(winTitle) - return - - if sideX = - sideX = R - if sideY = - sideY = R - if widthFactor is not number - widthFactor := sideX ? 0.5 : 1.0 - if heightFactor is not number - heightFactor := sideY ? 0.5 : 1.0 - - WinGetPos, x, y, w, h - - if wp_IsWhereWePutIt(hwnd, x, y, w, h) - { ; Check if user wants to restore. - if SubStr(sideX,1,1) = "R" - { ; Restore on X-axis. - restore_x := wp_GetProp(hwnd,"wpRestoreX") - restore_w := wp_GetProp(hwnd,"wpRestoreW") - StringTrimLeft, sideX, sideX, 1 - } - if SubStr(sideY,1,1) = "R" - { ; Restore on Y-axis. - restore_y := wp_GetProp(hwnd,"wpRestoreY") - restore_h := wp_GetProp(hwnd,"wpRestoreH") - StringTrimLeft, sideY, sideY, 1 - } - if (restore_x != "" || restore_y != "") - { ; If already at the "restored" size and position, do the normal thing instead. - if ((restore_x = x || restore_x = "") && (restore_y = y || restore_y = "") - && (restore_w = w || restore_w = "") && (restore_h = h || restore_h = "")) - { - restore_x = - restore_y = - restore_w = - restore_h = - } - } - } - else - { ; WindowPadX didn't put that window here, so save this position before moving. - wp_SetRestorePos(hwnd, x, y, w, h) - if SubStr(sideX,1,1) = "R" - StringTrimLeft, sideX, sideX, 1 - if SubStr(sideY,1,1) = "R" - StringTrimLeft, sideY, sideY, 1 - } - - ; If no direction specified, restore or only switch monitors. - if (sideX+0 = "" && restore_x = "") - restore_x := x, restore_w := w - if (sideY+0 = "" && restore_y = "") - restore_y := y, restore_h := h - - ; Determine which monitor contains the center of the window. - m := wp_GetMonitorAt(x+w/2, y+h/2) - - ; Get work area of active monitor. - gosub wp_CalcMonitorStats - ; Calculate possible new position for window. - gosub wp_CalcNewSizeAndPosition - - ; If the window is already there, - if (newx "," newy "," neww "," newh) = (x "," y "," w "," h) - { ; ..move to the next monitor along instead. - - if (sideX or sideY) - { ; Move in the direction of sideX or sideY. - SysGet, monB, Monitor, %m% ; get bounds of entire monitor (vs. work area) - x := (sideX=0) ? (x+w/2) : (sideX>0 ? monBRight : monBLeft) + sideX - y := (sideY=0) ? (y+h/2) : (sideY>0 ? monBBottom : monBTop) + sideY - newm := wp_GetMonitorAt(x, y, m) - } - else - { ; Move to center (Numpad5) - newm := m+1 - SysGet, mon, MonitorCount - if (newm > mon) - newm := 1 - } - - if (newm != m) - { m := newm - ; Move to opposite side of monitor (left of a monitor is another monitor's right edge) - sideX *= -1 - sideY *= -1 - ; Get new monitor's work area. - gosub wp_CalcMonitorStats - } - else - { ; No monitor to move to, alternate size of window instead. - if sideX - widthFactor /= 2 - else if sideY - heightFactor /= 2 - else - widthFactor *= 1.5 - } - - ; Calculate new position for window. - gosub wp_CalcNewSizeAndPosition - } - - ; Restore before resizing... - WinGet, state, MinMax - if state - WinRestore - - WinDelay := A_WinDelay - SetWinDelay, 0 - - if (is_resizable := wp_IsResizable()) - { - ; Move and resize. - WinMove,,, newx, newy, neww, newh - - ; Since some windows might be resizable but have restrictions, - ; check that the window has sized correctly. If not, adjust. - WinGetPos, newx, newy, w, h - } - if (!is_resizable || (neww != w || newh != h)) - { - ; If the window is smaller on a given axis, center it within - ; the space. Otherwise align to the appropriate side. - newx := Round(newx + (neww-w)/2 * (1 + (w>neww)*sideX)) - newy := Round(newy + (newh-h)/2 * (1 + (h>newh)*sideY)) - ; Move but (usually) don't resize. - WinMove,,, newx, newy, w, h - } - - ; Explorer uses WM_EXITSIZEMOVE to detect when a user finishes moving a window - ; in order to save the position for next time. May also be used by other apps. - PostMessage, 0x232 - - SetWinDelay, WinDelay - - wp_RememberPos(hwnd) - return - -wp_CalcNewSizeAndPosition: - ; Calculate desired size. - neww := restore_w != "" ? restore_w : Round(monWidth * widthFactor) - newh := restore_h != "" ? restore_h : Round(monHeight * heightFactor) - ; Fall through to below: -wp_CalcNewPosition: - ; Calculate desired position. - newx := restore_x != "" ? restore_x : Round(monLeft + (sideX+1) * (monWidth - neww)/2) - newy := restore_y != "" ? restore_y : Round(monTop + (sideY+1) * (monHeight - newh)/2) - return - -wp_CalcMonitorStats: - ; Get work area (excludes taskbar-reserved space.) - SysGet, mon, MonitorWorkArea, %m% - monWidth := monRight - monLeft - monHeight := monBottom - monTop - return -} - -/* -=============================================================================== -Function: WPXA_MoveMouseToMonitor - Moves mouse to center of given monitor - -Parameters: - md - monitor-id - -Author(s): - 20110125 - hoppfrosch - Initial -=============================================================================== -*/ -WPXA_MoveMouseToMonitor(md) -{ - SysGet, mc, MonitorCount - if (md<1 or md>mc) - return - - Loop, %mc% - SysGet, mon%A_Index%, MonitorWorkArea, %A_Index% - - ; Destination monitor - mdx := mon%md%Left - mdy := mon%md%Top - mdw := mon%md%Right - mdx - mdh := mon%md%Bottom - mdy - - mdxc := mdx+mdw/2, mdyc := mdy+mdh/2 - - CoordMode, Mouse, Screen - MouseMove, mdxc, mdyc, 0 - WPXA_MouseLocator() -} - - -/* -=============================================================================== -Function: WPXA_MoveWindowToMonitor - Move window between screens, preserving relative position and size. - -Parameters: - md - Monitor id - winTitle - windows title - -Author(s): - Original - Lexikos - http://www.autohotkey.com/forum/topic21703.html -=============================================================================== -*/ -WPXA_MoveWindowToMonitor(md, winTitle) -{ - if !wp_WinExist(winTitle) - return - - SetWinDelay, 0 - - WinGet, state, MinMax - if state - WinRestore - - WinGetPos, x, y, w, h - - ; Determine which monitor contains the center of the window. - ms := wp_GetMonitorAt(x+w/2, y+h/2) - - SysGet, mc, MonitorCount - - ; Determine which monitor to move to. - if md in ,N,Next - { - md := ms+1 - if (md > mc) - md := 1 - } - else if md in P,Prev,Previous - { - md := ms-1 - if (md < 1) - md := mc - } - - if (md=ms or (md+0)="" or md<1 or md>mc) - return - - ; Get source and destination work areas (excludes taskbar-reserved space.) - SysGet, ms, MonitorWorkArea, %ms% - SysGet, md, MonitorWorkArea, %md% - msw := msRight - msLeft, msh := msBottom - msTop - mdw := mdRight - mdLeft, mdh := mdBottom - mdTop - - ; Calculate new size. - if (wp_IsResizable()) { - w := Round(w*(mdw/msw)) - h := Round(h*(mdh/msh)) - } - - ; Move window, using resolution difference to scale co-ordinates. - WinMove,,, mdLeft + (x-msLeft)*(mdw/msw), mdTop + (y-msTop)*(mdh/msh), w, h - - if state = 1 - WinMaximize -} - -/* -=============================================================================== -Function: WPXA_MouseLocator - Easy find the mouse - -Requirements: - Windings-Font - -Author(s): - Original - Skrommel - http://www.donationcoder.com/Software/Skrommel/MouseMark/MouseMark.ahk - 20110127 - hoppfrosch - Modifications -=============================================================================== -*/ -WPXA_MouseLocator() -{ - applicationname := A_ScriptName - - SetWinDelay,0 - DetectHiddenWindows,On - CoordMode,Mouse,Screen - - delay := 100 - size1 := 250 - size2 := 200 - size3 := 150 - size4 := 100 - size5 := 50 - col1 := "Red" - col2 := "Blue" - col3 := "Yellow" - col4 := "Lime" - col5 := "Green" - boldness1 := 700 - boldness2 := 600 - boldness3 := 500 - boldness4 := 400 - boldness5 := 300 - - Transform, OutputVar, Chr, 177 - - Loop,5 - { - MouseGetPos,x,y - size:=size%A_Index% - width:=Round(size%A_Index%*1.4) - height:=Round(size%A_Index%*1.4) - colX:=col%A_Index% - boldness:=boldness%A_Index% - Gui,%A_Index%:Destroy - Gui,%A_Index%:+Owner +AlwaysOnTop -Resize -SysMenu -MinimizeBox -MaximizeBox -Disabled -Caption -Border -ToolWindow - Gui,%A_Index%:Margin,0,0 - Gui,%A_Index%:Color,123456 - - Gui,%A_Index%:Font,c%colX% S%size% W%boldness%,Wingdings - Gui,%A_Index%:Add,Text,,%OutputVar% - - Gui,%A_Index%:Show,X-%width% Y-%height% W%width% H%height% NoActivate,%applicationname%%A_Index% - WinSet,TransColor,123456,%applicationname%%A_Index% - } - Loop,5 - { - MouseGetPos,x,y - WinMove,%applicationname%%A_Index%,,% x-size%A_Index%/1.7,% y-size%A_Index%/1.4 - WinShow,%applicationname%%A_Index% - Sleep,%delay% - WinHide,%applicationname%%A_Index% - ;Sleep,%delay% - } - - Loop,5 - { - Gui,%A_Index%:Destroy - } -} - -/* -=============================================================================== -Function: WPXA_RollToggle - Toogles "Roll/Unroll" for given window - -Parameters: - WinTitle - Title of the window - -Author(s): - 20120116 - hoppfrosch - Original -=============================================================================== -*/ -WPXA_RollToggle(WinTitle) { - - Global NotifyOptions, NotifyDuration, Ico_Minus, Ico_Plus - - if hwnd := wp_WinExist(WinTitle) - { - _DBG_FName := A_ScriptName "-[WPXA_RollToggle] - " ; _DBG_ - WinGetClass, WinClass, ahk_id %hwnd% ; _DBG_ - WinGetTitle, WinTitle, ahk_id %hwnd% ; _DBG_ - - CurrWinTitle := wp_WinGetTitle(WinTitle) - wp_RollWindowToggle(hwnd) - if (wp_GetProp(hwnd,"wpRolledUp") = 0) - { - Notify(A_ScriptName,CurrWinTitle "`nRollWindow disabled - " hwnd, NotifyDuration, NotifyOptions Ico_Minus) - } - else - { - Notify(A_ScriptName,CurrWinTitle "`nRollWindow enabled - " hwnd, NotifyDuration, NotifyOptions Ico_Plus) - } - } -} - -/* -=============================================================================== -Function: WPXA_TileLast2Windows - Tile active and last window - -Author(s): - 20120316 - ipstone today - Initial (http://www.autohotkey.com/forum/viewtopic.php?p=521482#521482) -=============================================================================== -*/ -WPXA_TileLast2Windows() { - static tileOrientation := 0 - if (tileOrientation=0) - { - tileOrientation := 1 - WPXA_Move(-1,0,0.5,1.0, "A") - WPXA_Move(+1,0,0.5,1.0, "P") - } - else - { - tileOrientation := 0 - WPXA_Move(0,-1, 1.0, 0.5, "A") - WPXA_Move(0, 1, 1.0, 0.5, "P") - } -} - -/* -=============================================================================== -Function: WPXA_TopToggle - Toogles "Always On Top" for given window - -Parameters: - WinTitle - Title of the window - -Author(s): - 20110811 - hoppfrosch - Initial -=============================================================================== -*/ -WPXA_TopToggle(WinTitle) { - - Global NotifyOptions, NotifyDuration, Ico_Minus, Ico_Plus - - if hwnd := wp_WinExist(WinTitle) - { - WinSet, AlwaysOnTop, toggle - - _DBG_FName := A_ScriptName "-[WPXA_TopToggle] - " ; _DBG_ - WinGetClass, WinClass, ahk_id %hwnd% ; _DBG_ - WinGetTitle, WinTitle, ahk_id %hwnd% ; _DBG_ - - CurrWinTitle := wp_WinGetTitle(WinTitle) - if (wp_IsAlwaysOnTop(WinTitle)) - { - OutputDebug % _DBG_FName "AlwaysOnTop enabled for hwnd: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - Notify(A_ScriptName,CurrWinTitle "`nAlwaysOnTop enabled - " hwnd, NotifyDuration, NotifyOptions Ico_Plus) - //MsgBox, NotifyOptions - wp_SetProp(hwnd,"wpAlwaysOnTop",1) - } - else - { - OutputDebug % _DBG_FName "AlwaysOnTop disabled for hwnd: " hwnd " - win_class: " WinClass " - win_title: " WinTitle ; _DBG_ - Notify(A_ScriptName,CurrWinTitle "`nAlwaysOnTop disabled - " hwnd, NotifyDuration, NotifyOptions Ico_Minus) - wp_RemoveProp(hwnd,"wpAlwaysOnTop") - } - } -} - -/* -=============================================================================== -Function: WPXA_TrayMinWindow - Minimizes a window to a tray icon. - -Parameters: - WinTitle - Title of the window - -Author(s): - 20120509 - hoppfrosch - Initial -=============================================================================== -*/ -WPXA_TrayMinWindow(WinTitle) { - - if hwnd := wp_WinExist(WinTitle) - { - wp_WinTraymin(hwnd) - } -} - - -WM_SHELLHOOKMESSAGE(wParam, lParam, nMsg) -{ - Critical - If nMsg=1028 - { - If wParam=1028 - Return - Else If (lParam=0x201||lParam=0x205||lParam=0x207) - wp_WinTraymin(wParam,3) - } - Else If (wParam=1||wParam=2) - wp_WinTraymin(lParam,wParam) - Return 0 -} - -#include %A_ScriptDir%\_inc\Notify.ahk \ No newline at end of file diff --git a/WindowPadX/WindowPadX.Default.ini b/WindowPadX/WindowPadX.Default.ini deleted file mode 100644 index 33c8672..0000000 --- a/WindowPadX/WindowPadX.Default.ini +++ /dev/null @@ -1,117 +0,0 @@ -; -; See WindowPadX.html for more details about configuring WindowPadX. -; - -[Options] -TitleMatchMode=2 - -; -; [Hotkeys]: Hotkeys which are active by default. -; Hotkey sets using standard modifier keys such as -; * Ctrl (^) -; * Win (#) -; * Alt (!) -; * Shift (+) -; * For more see: http://l.autohotkey.net/docs/Hotkeys.htm -; should be placed directly in this section. [Hotkeys: NAME] sections -; must be enabled/disabled by a hotkey defined in this section. -; -[Hotkeys] -; Win+Numpad for Active Window: -#Numpad1 = WPXA_Move, -1, +1, 0.5, 0.5 -#Numpad2 = WPXA_Move, 0, +1, 1.0, 0.5 -#Numpad3 = WPXA_Move, +1, +1, 0.5, 0.5 -#Numpad4 = WPXA_Move, -1, 0, 0.5, 1.0 -#Numpad5 = WPXA_Move, 0, 0, 0.5, 1.0 -#Numpad6 = WPXA_Move, +1, 0, 0.5, 1.0 -#Numpad7 = WPXA_Move, -1, -1, 0.5, 0.5 -#Numpad8 = WPXA_Move, 0, -1, 1.0, 0.5 -#Numpad9 = WPXA_Move, +1, -1, 0.5, 0.5 -#!Numpad1 = WPXA_MoveMouseToMonitor, 1 -#!Numpad2 = WPXA_MoveMouseToMonitor, 2 -#!Numpad5 = WPXA_ClipCursorToCurrentMonitorToggle -#!Numpad0 = WPXA_MouseLocator -~RButton & LButton = WPXA_MouseLocator - -#NumpadAdd = WPXA_MaximizeToggle -#NumpadEnter = WPXA_MoveWindowToMonitor, Next -#NumpadDiv = WPXA_MinimizeWindowsOnMonitor, 1 -#!NumpadDiv = WPXA_GatherWindowsOnMonitor, 1 -#NumpadMult = WPXA_MinimizeWindowsOnMonitor, 2 -#!NumpadMult = WPXA_GatherWindowsOnMonitorOnMonitor, 2 -#NumpadSub = WPXA_TopToggle - - -; Custom modifier keys: -CapsLock = Hotkeys, Active Window (WADS) -Numpad0 = Hotkeys, Active Window (Numpad) -NumpadSub = Hotkeys, Previous Window (Numpad) - -; -; [Hotkeys: xxx]: Hotkeys which are enabled/disabled via the Hotkeys command. -; These are typically used to implement custom modifier keys. -; -[Hotkeys: Active Window (WADS)] -z = WPXA_Move, -1, +1, 0.5, 0.5 -x = WPXA_Move, 0, +1, 1.0, 0.5 -c = WPXA_Move, +1, +1, 0.5, 0.5 -a = WPXA_Move, -1, 0, 0.5, 1.0 -s = WPXA_Move, 0, 0, 0.5, 1.0 -d = WPXA_Move, +1, 0, 0.5, 1.0 -q = WPXA_Move, -1, -1, 0.5, 0.5 -w = WPXA_Move, 0, -1, 1.0, 0.5 -e = WPXA_Move, +1, -1, 0.5, 0.5 -Tab = WPXA_MaximizeToggle -Space = WPXA_MoveWindowToMonitor, Next -LAlt = WPXA_MoveWindowToMonitor, Prev -1 = WPXA_GatherWindowsOnMonitor, 1 -2 = WPXA_GatherWindowsOnMonitor, 2 - -[Hotkeys: Active Window (Numpad)] -*Numpad1 = WPXA_Move, -1, +1, 0.5, 0.5 -*Numpad2 = WPXA_Move, 0, +1, 1.0, 0.5 -*Numpad3 = WPXA_Move, +1, +1, 0.5, 0.5 -*Numpad4 = WPXA_Move, -1, 0, 0.5, 1.0 -*Numpad5 = WPXA_Move, 0, 0, 0.5, 1.0 -*Numpad6 = WPXA_Move, +1, 0, 0.5, 1.0 -*Numpad7 = WPXA_Move, -1, -1, 0.5, 0.5 -*Numpad8 = WPXA_Move, 0, -1, 1.0, 0.5 -*Numpad9 = WPXA_Move, +1, -1, 0.5, 0.5 -*NumpadAdd = WPXA_MaximizeToggle -*NumpadEnter = WPXA_MoveWindowToMonitor, Next - -[Hotkeys: Previous Window (Numpad)] -*Numpad1 = WPXA_Move, -1, +1, 0.5, 0.5, P -*Numpad2 = WPXA_Move, 0, +1, 1.0, 0.5, P -*Numpad3 = WPXA_Move, +1, +1, 0.5, 0.5, P -*Numpad4 = WPXA_Move, -1, 0, 0.5, 1.0, P -*Numpad5 = WPXA_Move, 0, 0, 0.5, 1.0, P -*Numpad6 = WPXA_Move, +1, 0, 0.5, 1.0, P -*Numpad7 = WPXA_Move, -1, -1, 0.5, 0.5, P -*Numpad8 = WPXA_Move, 0, -1, 1.0, 0.5, P -*Numpad9 = WPXA_Move, +1, -1, 0.5, 0.5, P -*NumpadAdd = WPXA_MaximizeToggle, P -*NumpadEnter = WPXA_MoveWindowToMonitor, Next, P - -; -; [Exclude Windows]: Hotkeys are disabled for these windows. -; -[Exclude Windows] -Window=Virtual PC -Window=Remote Desktop - -; -; [Gather: Exclude Windows]: WPXA_GatherWindowsOnMonitor ignores these windows when gathering. -; -[Gather: Exclude Windows] -Window=ahk_class SideBar_AppBarWindow -Window=ahk_class SideBar_HTMLHostWindow -Window=ahk_class BasicWindow - -; -; [Gather: Exclude Processes]: WPXA_GatherWindowsOnMonitor ignores windows belonging to these processes. -; It is usually not necessary to use both this and the above. -; -[Gather: Exclude Processes] -; Process=sidebar.exe -Process=clocx.exe diff --git a/WindowPadX/WindowPadX.ahk b/WindowPadX/WindowPadX.ahk deleted file mode 100644 index 70b98f1..0000000 --- a/WindowPadX/WindowPadX.ahk +++ /dev/null @@ -1,485 +0,0 @@ -/* -Title: _WindowPadX - -*Handling windows in general and within a multi-monitor setup in special* - -derived from *WindowPad* by *Lexikos* (http://www.autohotkey.com/forum/topic21703.html) - -See also the documentation of original *WindowPad* by *Lexikos* (http://www.autohotkey.com/forum/topic21703.html), as *WindowPadX* is just a simple clone of *WindowPad* with reengineering and a few enhancements .... - -Documentation: -- - Using *WindowPadX* from the commandline -- - Implement your own commands - -Requires: - AutoHotkey v1.1.0 or later. - -Author: - hoppfrosch - -Version History: - 1.2.2 - 22.Mar.2012 Hoppfrosch - [+] WPXA.ahk v0.2.0: : Bugfix for rolling up windows to its titlebar - 1.2.1 - 22.Mar.2012 Hoppfrosch - [+] WPXA.ahk v0.1.10: : Determine monitor where mouse is - [*] WPXA.ahk v0.1.10: : Minimize windows on screen where mouse is - 1.2.0 - 19.Mar.2012 Hoppfrosch - [+] WPXA.ahk v0.1.9: : Tile active and last window (Credits: ipstone today (http://www.autohotkey.com/forum/viewtopic.php?p=521482#521482)) - 1.1.1 - 26.Jan.2012 Hoppfrosch - [*] WPXA.ahk v0.1.8: : Bugfix to actually toggle Maximization - 1.1.0 - 13.Jan.2012 Hoppfrosch - [*] WPXA.ahk v0.1.6: : Reanimated Notifications - [+] WPXA.ahk v0.1.7: : New action for toggling rolling a window to its captionbar - 1.0.1 - 13.Jan.2012 Hoppfrosch - [*] WPXA.ahk v0.1.5: : Using integer coordinates for Gui Show - 1.0.0 - 12.Jan.2012 Hoppfrosch: Initial release of WindowPadX -*/ - -/* - --------------------------------------------------------------------------------------- -Ideensammlung: -* Transparenz f�r Fenster -* Overlay-Icon in Taskbar, um anzuzeigen auf welchem Screen sich das Fenster befindet ... (Funktion aus ITaskBar von maul.esel). Dies sollte bei verlassen des Programmes auch wieder entfernt werden. - Hinweise: - * http://www.autohotkey.com/forum/viewtopic.php?t=74314 - * http://www.autohotkey.com/forum/viewtopic.php?t=70978 -* "TaskSwitcher" fuer jeden Monitor - Hinweise: - * http://www.autohotkey.com/forum/viewtopic.php?t=71912 --------------------------------------------------------------------------------------- -*/ - -#include %A_ScriptDir%/WPXA.ahk - -#SingleInstance force - -Version := "1.2.2" - -if 0 > 0 -{ - ; Command-line mode: interpret each arg as a pseudo-command. - ; Suspend all hotkeys which may be created by WindowPadXInit. - Suspend On - ; Load options and Gather exclusions. - gosub WindowPadXInit - ; Execute command line(s). Each args should be in one of these formats: - ; - ; , - ; ", " ; In this case the initial comma is optional. - Loop %0% - wp_ExecLine(%A_Index%) - ExitApp -} - -OnExit, TrayExit - -WindowPadXInit: - ; If this script is #included in another script, this section may not be - ; auto-executed. In that case, the following should be called manually: - WindowPadX_Init(WINDOWPADX_INI_PATH) - return - -WindowPadX_Init(IniPath="") -{ - global WINDOWPADX_INI_PATH - ; - ; Init icons and tray menu. - ; - if A_IsCompiled ; Load icons from my custom WindowPadX.exe. - { - ; Default icon is 32x32, so doesn't look good in the tray. - Menu, Tray, Icon, %A_ScriptFullPath%, 2 - } - else if (A_LineFile = A_ScriptFullPath) - { ; Set the tray icon, but only if not included in some other script. - wp_SetTrayIcon(true) - ; Use OnMessage to catch "Suspend Hotkeys" or "Pause Script" - ; so the "disabled" icon can be used. - OnMessage(0x111, "WM_COMMAND") - } - - Menu, Tray, NoStandard - Menu, Tray, MainWindow - Menu, Tray, Add, &Debug, TrayDebug - ifExist, %A_ScriptDir%\WindowPadX.html - { - Menu, Tray, Add, &Help, TrayHelp - Menu, Tray, Add - } - Menu, Tray, Add, &Reload, TrayReload - if !A_IsCompiled - { - Menu, Tray, Add, &Edit Source, TrayEdit - } - Menu, Tray, Add, Edit &Configuration, TrayEditConfig - Menu, Tray, Add - Menu, Tray, Add, &Suspend, TraySuspend - Menu, Tray, Add, E&xit, TrayExit - Menu, Tray, Default, &Debug - ; - ; Load settings. - ; - if IniPath = - Loop, %A_LineFile%\..\WindowPadX.ini - IniPath := A_LoopFileFullPath - ifNotExist %IniPath% - { - IniPath = %A_ScriptDir%\WindowPadX.ini - FileInstall, WindowPadX.Default.ini, %IniPath% - } - WINDOWPADX_INI_PATH := IniPath - WindowPadX_LoadSettings(IniPath) -} - -WindowPadX_LoadSettings(ininame) -{ - local v - - ; Misc Options - IniRead, v, %ininame%, Options, TitleMatchMode, %A_TitleMatchMode% - SetTitleMatchMode, %v% - - ; Hotkeys: Exclude Windows - v := wp_INI_GetList(ininame, "Exclude Windows", "Window") - Loop, Parse, v, `n - GroupAdd, HotkeyExclude, %A_LoopField% - - ; Read the Hotkeys section in. - v := wp_INI_ReadSection(ininame, "Hotkeys") - ; Replace the first = with ::. - ; ('=' is required for WritePrivateProfileSection to work properly.) - v := RegExReplace(v, "m`a)^(.*?)=", "$1::") - Hotkey, IfWinNotActive, ahk_group HotkeyExclude - Hotkey_Params(v) - - ; Gather: Exclude Windows - v := wp_INI_GetList(ininame, "Gather: Exclude Windows", "Window") - Loop, Parse, v, `n - GroupAdd, GatherExclude, %A_LoopField% - - ; Gather: Exclude Processes - ProcessGatherExcludeList := wp_INI_GetList(ininame - , "Gather: Exclude Processes", "Process", ",") -} - -wp_INI_GetList(ininame, Section, Key, Delim="`n") -{ - v := wp_INI_ReadSection(ininame, Section) - Loop, Parse, v, `n - { - pos := InStr(A_LoopField, "=") - if (pos && SubStr(A_LoopField,1,pos-1) = Key) - list .= (list ? Delim : "") . SubStr(A_LoopField, pos+1) - } - return list -} - -wp_INI_ReadSection(Filename, Section) -{ - char_type := A_IsUnicode ? "UShort" : "UChar" - char_size := A_IsUnicode ? 2 : 1 - - ; Expand relative paths, since GetPrivateProfileSection only searches %A_WinDir%. - Loop, %Filename%, 0 - Filename := A_LoopFileLongPath - - VarSetCapacity(buf, 0x7FFF*char_size, 0) - - len := DllCall("GetPrivateProfileSection" - , "uint", &Section, "uint", &buf, "uint", 0x7FFF, "uint", &Filename) - - VarSetCapacity(text, len*char_size), p := &buf - ; For each null-terminated substring, - while (s := DllCall("MulDiv", "int", p, "int", 1, "int", 1, "str")) - ; append it to the output and advance to the next substring. - text .= s "`n", p += (StrLen(s)+1)*char_size - - ; Strip the trailing newline - text := SubStr(text, 1, -1) - - ; Windows Me/98/95: - ; The returned string includes comments. - ; - ; This removes comments. Also, I'm not sure if leading/trailing space is - ; automatically removed on Win9x, so the regex removes that too. - if A_OSVersion in WIN_ME,WIN_98,WIN_95 - text := RegExReplace(text, "m`n)^[ `t]*(?:;.*`n?|`n)|^[ `t]+|[ `t]+$") - - return text -} - - -; Tray menu subroutines. May also be assigned to hotkeys in WindowPadX.ini. -TrayDebug: - ListHotkeys - return -TrayHelp: - Run, %A_ScriptDir%\WindowPadX.html - return -TrayReload: - Reload - return -TrayEdit: - Edit - return -TrayEditConfig: - RegRead, Editor, HKCR, AutoHotkeyScript\Shell\Edit\Command - StringReplace, Editor, Editor, "`%1", - Editor := RegExReplace(Editor, "(^\s*|\s*$)") - if (Editor = ) - Editor = notepad - Run, %Editor% "%A_ScriptDir%\WindowPadX.ini" - return -TraySuspend: - WM_COMMAND(65305,0) - Suspend - Menu, Tray, % A_IsSuspended ? "Check" : "Uncheck", &Suspend - return -TrayExit: - - - wp_Restore() - ExitApp - - - -; -; Hotkeys: Activate hotkeys defined in INI section [Hotkeys: %section%]. -; -Hotkeys(section, options) -{ - local this_hotkey, section_var, hotkeys, wait_for_keyup, m, m1, pos, k - static key_regex = "^(?:.* & )?[#!^+&<>*~$]*(.+)" - - this_hotkey := A_ThisHotkey - - if !section - goto HC_SendThisHotkeyAndReturn - - pos := RegExMatch(options, "i)(?<=\bD)\d*\.?\d*", m) - if pos - { - options := SubStr(options, 1, pos-2) . SubStr(options, pos+StrLen(m)) - if (m+0 = "") - m := 0.1 - Input, k, L1 T%m% - if ErrorLevel != Timeout - { - gosub HC_SendThisHotkey - Send %k% - return - } - } - - section_var := RegExReplace(section, "[^\w#@$]", "_") - hotkeys := Hotkeys_%section_var% - - if hotkeys = - { - ; Load each hotkeys section on first use. Since the ini file may be - ; edited between enabling and disabling the hotkeys, loading them - ; each and every time would be hazardous. - hotkeys := wp_INI_ReadSection(WINDOWPADX_INI_PATH, "Hotkeys: " section) - if hotkeys = - goto HC_SendThisHotkeyAndReturn - - ; key=command -> key::command - hotkeys := RegExReplace(hotkeys, "m`a)^(.*?)=", "$1::") - - Hotkeys_%section_var% := hotkeys - } - - ; If Options were omitted and this is a key-down hotkey, - ; automatically disable the hotkeys when the key is released. - if (wait_for_keyup := (options="" && SubStr(this_hotkey,-2) != " up")) - options = On ; Explicit "on" in case hotkey exists but is disabled. - - Hotkey, IfWinNotActive, ahk_group HotkeyExclude - Hotkey_Params(hotkeys, options) - - if (wait_for_keyup) - { - if (!RegExMatch(this_hotkey, key_regex, m) || GetKeyState(m1)="") { - MsgBox, % "Error retrieving primary key of hotkey in Hotkeys().`n" - . "`tHotkey: " this_hotkey "`n" - . "`tResult: " m1 - . "`nPlease inform Lexikos. Tip: Press Ctrl+C to copy this message." - return - } - - KeyWait, %m1% - - Hotkey_Params(hotkeys, "Off") - - ; A_ThisHotkey: "The key name of the *most recently executed* hotkey" - ;if(some other hotkey was executed during KeyWait) - if (this_hotkey = A_ThisHotkey) - goto HC_SendThisHotkeyAndReturn - } - return - -HC_SendThisHotkey: -HC_SendThisHotkeyAndReturn: - if ! InStr(this_hotkey, "~") - if (RegExMatch(this_hotkey, key_regex, m) && GetKeyState(m1)!="") { - Hotkey, %this_hotkey%, Off - Send {Blind}{%m1%} - Hotkey, %this_hotkey%, On - } - return -} - - -; -; Commands implemented as labels for simplicity. -; -Send: - Send, %Params% - return -Minimize: - if wp_WinExist(Params) - PostMessage, 0x112, 0xF020 ; WM_SYSCOMMAND, SC_MINIMIZE - return -Unminimize: - if wp_WinLastMinimized() - WinRestore - return -Restore: - if wp_WinExist(Params) - WinRestore - return - -; -; Internal Functions -; -; Execute a pseudo-command with params. -wp_ExecLine(cmdline) -{ - if RegExMatch(cmdline, "^\s*(?\S+?)(?:[, `t]\s*(?.*?))?\s*$", a) - { - global Params := aParams ; Global for use by label-based pseudo-commands. - if (n := IsFunc(aName)) && n <= 6 - { ; %aName% is a function with up to 5 params. - if n > 2 - { ; Two or more required parameters. - if RegExMatch(aParams, "^(?:[^,]*,){1," n-2 "}\s*", aParams) - StringSplit, p, aParams, `,, %A_Space%%A_Tab% - else ; no comma - p0 := 1 - p%p0% := SubStr(Params, StrLen(aParams) + 1) - } - else - ; At most one required parameter. - p1 := Params - ; Call function with values supplied for only the required params. - ; This allows commas to be treated literally in the last param. - return %aName%(p1, p2, p3, p4, p5) - } - else - ; aName is a label or invalid. - gosub %aName% - } -} - -; Hotkey_Params( line [, Options ] ) -; Associates a hotkey with a parameter string. -; -; Expects a newline(`n)-delimited list of hotkeys in the form: -; Hotkey:: LabelName, Params -; -; Note: -; - Spaces are optional. -; - As with hotkey labels, there should be no space between 'Hotkey' and '::'. -; - Unlike the Hotkey command, LabelName MUST NOT be omitted. -; - Params MUST NOT contain a newline character (`n). -; - Params may contain zero or more commas. -; - , (comma) is supported as a hotkey. -; - Unlike the Hotkey command, 'Toggle' should be specified in the Options, not as a label. -; -; Returns the number of hotkeys successfully enabled/disabled. -; -Hotkey_Params(line, Options="") -{ - static List ; List of hotkeys and associated labels + parameters. - , sCmdLine ; temp var used by hotkey subroutine. - - count = 0 - - ; Note: The parsing loop operates on a temporary copy of 'line', - ; so 'line' can be (and is) reused within the loop. - - Loop, Parse, line, `n, %A_Space%%A_Tab% - { - ; Clear ErrorLevel in case UseErrorLevel is (not) specified. - ErrorLevel = - - if ! RegExMatch(A_LoopField, "^\s*(?.+?)::\s*(?.+?)(?:[, `t]\s*(?.*?))?\s*$", line) - continue - - if !(IsLabel(lineName) || IsFunc(lineName)) - continue - - if Options = Toggle ; Not supported as an option (must be Label.) - { - ; Toggle hotkey. If it doesn't exist, the next line will enable it. - Hotkey, %lineHotkey%, Toggle, UseErrorLevel - ; Ensure the hotkey will execute the correct label. - Hotkey, %lineHotkey%, hp_ExecuteHotkeyWithParams, UseErrorLevel - } else - Hotkey, %lineHotkey%, hp_ExecuteHotkeyWithParams, %Options% - - ; Check ErrorLevel in case UseErrorLevel was specified. - if ErrorLevel - continue - - ; Rebuild line to remove whitespace. - line := lineHotkey "::" lineName "," lineParams - - ; Update an existing hotkey's label + params, - temp := RegExReplace(List, "m`n)^\Q" lineHotkey "\E::.*$", line, repl, 1) - if (repl > 0) - List := temp - else ; or add a new hotkey to the list. - List .= (List ? "`n" : "") . line - - count += 1 - } - return count - -hp_ExecuteHotkeyWithParams: - if RegExMatch(List, "m`n)^\Q" A_ThisHotkey "\E::\K.*", sCmdLine) - wp_ExecLine(sCmdLine) -return -} - - -; -; Tray Icon Override: -; Provides a way to customize the icons without compiling the script. -; - -WM_COMMAND(wParam, lParam) -{ - static IsPaused, IsSuspended - Critical - id := wParam & 0xFFFF - if id in 65305,65404,65306,65403 - { ; "Suspend Hotkeys" or "Pause Script" - if id in 65306,65403 ; pause - IsPaused := ! IsPaused - else ; at this point, A_IsSuspended has not yet been toggled. - IsSuspended := ! A_IsSuspended - wp_SetTrayIcon(!(IsPaused or IsSuspended)) - } -} - -wp_SetTrayIcon(is_enabled) -{ - icon := is_enabled ? "tray.ico" : "disabled.ico" - icon = %A_ScriptDir%\icons\%icon% - - ; avoid an error message if the icon doesn't exist - IfExist, %icon% - Menu, TRAY, Icon, %icon%,, 1 -} diff --git a/WindowPadX/WindowPadX.html b/WindowPadX/WindowPadX.html deleted file mode 100644 index 5e70c1f..0000000 --- a/WindowPadX/WindowPadX.html +++ /dev/null @@ -1,427 +0,0 @@ - - - - - WindowPadX v0.1.0 - - - - -

WindowPadX  v0.1.0

- -
-
-

Adding Commands

-

Additional commands for use in WindowPadX.ini may be implemented by simply adding subroutines or functions to WindowPadX.ahk. For instance, a Close command could be implemented by adding either of the following:

-
Close: ; Subroutine version
-    if wp_WinExist(Params)
-        WinClose
-    return
-    
-Close(winTitle) { ; Function version, requires v1.60+
-    if wp_WinExist(winTitle)
-        WinClose
-}
-

It would then be used like any other WindowPadX command, by adding something like this to WindowPadX.ini:

-
!4 = Close, A
-
-

Note that AutoHotkey or Ahk2Exe is required to run or compile WindowPadX.ahk after making changes.

-
-
-

Command-line Usage

-

As of v1.56, WindowPadX supports a command-line mode. Simply pass one or more commands on the command-line and WindowPadX will execute them and then exit. If a command's parameters contain spaces, the command and its arguments must be enclosed in quotation marks. For example: -

WindowPadX.exe GatherWindows,1 "WindowScreenMove, Next, My Window"
-
-
-
-

Configuration

-

All configuration is currently done by editing WindowPadX.ini.

-

Hotkeys

-

Hotkeys are defined in [Hotkeys] sections. Each section contains a list of hotkey=command bindings. The syntax for a binding is:

-
Hotkey = Command, Params
-

Hotkey may be any valid AutoHotkey hotkey. Command must be a WindowPadX command, defined in the script as a label.

-

Hotkeys defined in the [Hotkeys] section are initially active when WindowPadX loads. Hotkey sets which use standard modifier keys like Ctrl (^) or Win (#) should be placed directly in this section.

-
[Hotkeys]
-#Num
-
-

Custom modifier keys may be implemented by placing "pad" keys (excluding the modifier key) in a [Hotkeys: Name] section, and a hotkey in the [Hotkeys] section to enable/disable it:

-
[Hotkeys]
-ModifierKey = Hotkeys, Name
-...
-[Hotkeys: Name]
-Key1 = Command, Params
-Key2 = Command, Params
-...
-

Options

-

TitleMatchMode: Defines the default title matching mode for the script. -

If WindowPadX is #included in another script, WindowPad_Init() must be called from the auto-execute section for this option to work. -

[Options]
-TitleMatchMode=2
-
-

-

Exclude Windows

-

WindowPadX hotkeys are disabled for windows listed in this section. -

[Exclude Windows]
-Window=Virtual PC
-Window=ahk_class TSSHELLWND
-; TSSHELLWND is the window class of Remote Desktop.
-
-

-

Gather Exclusions

-

Windows may be excluded from "gathering" either by title or by process. -

In the following example, either section may be used to prevent GatherWindows from affecting Windows Vista's side bar.

[Gather: Exclude Windows]
-Window=ahk_class SideBar_AppBarWindow
-Window=ahk_class SideBar_HTMLHostWindow
-Window=ahk_class BasicWindow
-
-[Gather: Exclude Processes]
-Process=sidebar.exe
-
-

-
-
-

FillVirtualScreen

-

Expands a window to fill the entire virtual screen, which encompasses all screens in a multi-monitor setup.

-

FillVirtualScreen, WinTitle

-

Parameters

- - - - - -
WinTitleSee Window Titles.
-
-
-

GatherWindows

-

Gathers windows onto a single monitor.

-

GatherWindows, WinTitle
-GatherWindows, Monitor

-

Parameters

- - - - - - - - - -
WinTitleGather windows onto the monitor which contains this window. See Window Titles.
MonitorA monitor number, where 1 is the first monitor.
-
-
-

Hotkeys

-

Enables or disables a set of hotkeys.

-

Hotkeys, Section, Options

-

Parameters

- - - - - - - - - -
SectionThe name of a hotkey set defined in WindowPadX.ini, excluding the Hotkeys: prefix.
OptionsAny option or string of options compatible with AutoHotkey's Hotkey command. For instance, On or Off. -

The word Toggle to toggle each hotkey in the set. -

Specify D%time% to indicate that the hotkey that launched this command must be held for at least %time% seconds before the hotkey set is enabled. -

If no options are specified, the hotkeys will be automatically disabled when the hotkey that launched this command is released.

-

Example

-

In the following example, the hotkey set is enabled if CapsLock is held for 0.2 seconds, and automatically disabled when CapsLock is released:

[Hotkeys]
-CapsLock = Hotkeys, Active Window, D0.2
-
-[Hotkeys: Active Window]
-z = WindowPadMove, -1, +1,  0.5, 0.5
-x = WindowPadMove,  0, +1,  1.0, 0.5
-...
-
-

-
-
-

MaximizeToggle

-

Maximizes or restores a window.

-

MaximizeToggle, WinTitle

-

Parameters

- - - - - -
WinTitleIndicates which window to maximize or restore. See Window Titles.
-
-
-

Minimize

-

Minimizes a window.

-

Minimize, WinTitle

-

Parameters

- - - - - -
WinTitleIndicates which window to minimize. See Window Titles.
-
-
-

Restore

-

Restores a window.

-

Restore, WinTitle

-

Parameters

- - - - - -
WinTitleIndicates which window to restore. See Window Titles.
-
-
-

Send

-

Analogous to AutoHotkey's Send command.

-

Send, Keys

-

Remarks

-

The comma is required.

-
-
-

Unminimize

-

Restores the most recently minimized window.

-

Unminimize

-
-
-

Version History

-

Version 0.1.0: -

-

-
-
-

Window Titles

-

WindowPadX commands accept any of the following for the WinTitle parameter: -

    -
  • Empty or omitted: the active window.
  • -
  • Any standard AutoHotkey WinTitle. For instance, Untitled - Notepad and ahk_class Notepad are both acceptable, and A specifies the active window.
  • -
  • P: the window below the active window in the z-order, which is usually but not always the previously active window.
  • -
  • M: the window under the mouse cursor.
  • -
  • _ (underscore): the top-most minimized window, which is usually the most recently minimized.
  • -

-
-
-

WindowPadMove

-

Simultaneously moves and resizes a window, based on a "pad" concept.

-

WindowPadMove, X, Y [, WidthFactor, HeightFactor, WinTitle ]

-

Parameters

- - - - - - - - - - - - - - - - - - - - - -
X-1 (left), 0 (center) or +1 (right)
Y-1 (up), 0 (center) or +1 (down)
WidthFactorA number between 0.0 and 1.0, where 0.5 is half of the screen's width.
HeightFactorA number between 0.0 and 1.0, where 0.5 is half of the screen's height.
WinTitleIndicates which window to move. See Window Titles.
-

Remarks

-

[ Brackets denote optional parameters. ]

-

WindowPadMove performs the first applicable action from the following list:

-
    -
  • If the window is not already occupying the indicated portion of the current monitor, move and resize.
  • -
  • If X or Y are non-zero and there is another monitor in the indicated direction, move to it. If both X and Y are non-zero, the move is strictly diagonal and may not be applicable to all multi-monitor setups.
  • -
  • If X and Y are zero and there are multiple monitors, move to the "next" monitor.
  • -
  • If X is non-zero, halve the width of the window, effectively "squashing" the window against the side of the screen.
  • -
  • If Y is non-zero, halve the height of the window.
  • -
  • Increase the width of the window by 50%. Usually X and Y are zero, the window is already in place, and there is only one monitor.
  • -
-

If the window is minimized or maximized, it will be restored before it is moved.

-
-
-

WindowScreenMove

-

Moves a window between monitors (screens.)

-

WindowScreenMove, Monitor, WinTitle

-

Parameters

- - - - - - - - - -
MonitorNext, Previous or a monitor number, where 1 is the first monitor. N, P and Prev are also acceptable.
WinTitleIndicates which window to move. See Window Titles.
-
-
- - \ No newline at end of file diff --git a/WindowPadX/WindowPadX.ini b/WindowPadX/WindowPadX.ini deleted file mode 100644 index cf718e6..0000000 --- a/WindowPadX/WindowPadX.ini +++ /dev/null @@ -1,117 +0,0 @@ -; -; See WindowPadX.html for more details about configuring WindowPadX. -; - -[Options] -TitleMatchMode=2 - -; -; [Hotkeys]: Hotkeys which are active by default. -; Hotkey sets using standard modifier keys such as -; * Ctrl (^) -; * Win (#) -; * Alt (!) -; * Shift (+) -; * For more see: http://l.autohotkey.net/docs/Hotkeys.htm -; should be placed directly in this section. [Hotkeys: NAME] sections -; must be enabled/disabled by a hotkey defined in this section. -; -[Hotkeys] -; Win+Numpad for Active Window: -; #Numpad1 = WPXA_Move, -1, +1, 0.5, 0.5 -; #Numpad2 = WPXA_Move, 0, +1, 1.0, 0.5 -; #Numpad3 = WPXA_Move, +1, +1, 0.5, 0.5 -; #Numpad4 = WPXA_Move, -1, 0, 0.5, 1.0 -; #Numpad5 = WPXA_Move, 0, 0, 0.5, 1.0 -; #Numpad6 = WPXA_Move, +1, 0, 0.5, 1.0 -; #Numpad7 = WPXA_Move, -1, -1, 0.5, 0.5 -; #Numpad8 = WPXA_Move, 0, -1, 1.0, 0.5 -; #Numpad9 = WPXA_Move, +1, -1, 0.5, 0.5 -; #!Numpad1 = WPXA_MoveMouseToMonitor, 1 -; #!Numpad2 = WPXA_MoveMouseToMonitor, 2 -; #!Numpad5 = WPXA_ClipCursorToCurrentMonitorToggle -; #!Numpad0 = WPXA_MouseLocator -; ~RButton & LButton = WPXA_MouseLocator - -#NumpadAdd = WPXA_MaximizeToggle -#NumpadEnter = WPXA_MoveWindowToMonitor, Next -#NumpadDiv = WPXA_MinimizeWindowsOnMonitor, 1 -#!NumpadDiv = WPXA_GatherWindowsOnMonitor, 1 -#NumpadMult = WPXA_MinimizeWindowsOnMonitor, 2 -#!NumpadMult = WPXA_GatherWindowsOnMonitorOnMonitor, 2 -#NumpadSub = WPXA_TopToggle - - -; Custom modifier keys: -RAlt = Hotkeys, Active Window (WADS) -; Numpad0 = Hotkeys, Active Window (Numpad) -; NumpadSub = Hotkeys, Previous Window (Numpad) - -; -; [Hotkeys: xxx]: Hotkeys which are enabled/disabled via the Hotkeys command. -; These are typically used to implement custom modifier keys. -; -[Hotkeys: Active Window (WADS)] -z = WPXA_Move, -1, +1, 0.5, 0.5 -x = WPXA_Move, 0, +1, 1.0, 0.5 -c = WPXA_Move, +1, +1, 0.5, 0.5 -a = WPXA_Move, -1, 0, 0.5, 1.0 -s = WPXA_Move, 0, 0, 0.5, 1.0 -d = WPXA_Move, +1, 0, 0.5, 1.0 -q = WPXA_Move, -1, -1, 0.5, 0.5 -w = WPXA_Move, 0, -1, 1.0, 0.5 -e = WPXA_Move, +1, -1, 0.5, 0.5 -Space = WPXA_MaximizeToggle -Tab = WPXA_MoveWindowToMonitor, Next -LAlt = WPXA_MoveWindowToMonitor, Prev -1 = WPXA_GatherWindowsOnMonitor, 1 -2 = WPXA_GatherWindowsOnMonitor, 2 - -[Hotkeys: Active Window (Numpad)] -*Numpad1 = WPXA_Move, -1, +1, 0.5, 0.5 -*Numpad2 = WPXA_Move, 0, +1, 1.0, 0.5 -*Numpad3 = WPXA_Move, +1, +1, 0.5, 0.5 -*Numpad4 = WPXA_Move, -1, 0, 0.5, 1.0 -*Numpad5 = WPXA_Move, 0, 0, 0.5, 1.0 -*Numpad6 = WPXA_Move, +1, 0, 0.5, 1.0 -*Numpad7 = WPXA_Move, -1, -1, 0.5, 0.5 -*Numpad8 = WPXA_Move, 0, -1, 1.0, 0.5 -*Numpad9 = WPXA_Move, +1, -1, 0.5, 0.5 -*NumpadAdd = WPXA_MaximizeToggle -*NumpadEnter = WPXA_MoveWindowToMonitor, Next - -[Hotkeys: Previous Window (Numpad)] -*Numpad1 = WPXA_Move, -1, +1, 0.5, 0.5, P -*Numpad2 = WPXA_Move, 0, +1, 1.0, 0.5, P -*Numpad3 = WPXA_Move, +1, +1, 0.5, 0.5, P -*Numpad4 = WPXA_Move, -1, 0, 0.5, 1.0, P -*Numpad5 = WPXA_Move, 0, 0, 0.5, 1.0, P -*Numpad6 = WPXA_Move, +1, 0, 0.5, 1.0, P -*Numpad7 = WPXA_Move, -1, -1, 0.5, 0.5, P -*Numpad8 = WPXA_Move, 0, -1, 1.0, 0.5, P -*Numpad9 = WPXA_Move, +1, -1, 0.5, 0.5, P -*NumpadAdd = WPXA_MaximizeToggle, P -*NumpadEnter = WPXA_MoveWindowToMonitor, Next, P - -; -; [Exclude Windows]: Hotkeys are disabled for these windows. -; -[Exclude Windows] -Window=Virtual PC -Window=Remote Desktop - -; -; [Gather: Exclude Windows]: WPXA_GatherWindowsOnMonitor ignores these windows when gathering. -; -[Gather: Exclude Windows] -Window=ahk_class SideBar_AppBarWindow -Window=ahk_class SideBar_HTMLHostWindow -Window=ahk_class BasicWindow - -; -; [Gather: Exclude Processes]: WPXA_GatherWindowsOnMonitor ignores windows belonging to these processes. -; It is usually not necessary to use both this and the above. -; -[Gather: Exclude Processes] -; Process=sidebar.exe -Process=clocx.exe diff --git a/WindowPadX/_inc/Notify.ahk b/WindowPadX/_inc/Notify.ahk deleted file mode 100644 index 35a0b03..0000000 --- a/WindowPadX/_inc/Notify.ahk +++ /dev/null @@ -1,406 +0,0 @@ -;������������������������������������������������������ -;�������� Notify() 0.499 by gwarble �������� -;����� ����� -;��� easy multiple tray area notifications ��� -;�� http://www.autohotkey.net/~gwarble/Notify/ �� -;������������������������������������������������������ -; -; Notify([Title,Message,Duration,Options]) -; -; Duration seconds to show notification [Default: 30] -; 0 for permanent/remain until clicked (flashing) -; -3 negative value to ExitApp on click/timeout -; "-0" for permanent and ExitApp when clicked (needs "") -; -; Options string of options, single-space seperated, ie: -; "TS=16 TM=8 TF=Times New Roman GC_=Blue SI_=1000" -; most options are remembered (static), some not (local) -; Option_= can be used for non-static call, ie: -; "GC=Blue" makes all future blue, "GC_=Blue" only takes effect once -; "Wait=ID" to wait for a notification -; "Update=ID" to change Title, Message, and Progress Bar (with 'Duration') -; -; Return ID (Gui Number used) -; 0 if failed (too many open most likely) -; VarValue if Options includes: Return=VarName -;������������������������������������������������������ - -Notify(Title="Notify()",Message="",Duration="",Options="") -{ - static GNList, ACList, ATList, AXList, Exit, _Wallpaper_, _Title_, _Message_, _Progress_, _Image_, Saved - static GF := 50 ; Gui First Number - static GL := 74 ; Gui Last Number (which defines range and allowed count) - static GC,GR,GT,BC,BK,BW,BR,BT,BF ; static options, remembered between calls - static TS,TW,TC,TF,MS,MW,MC,MF - static SI,SC,ST,IW,IH,IN,XC,XS,XW,PC,PB - - If (Options) ; skip parsing steps if Options param isn't used - { - Options.=" " ; poor whitespace handling for next parsing step (ensures last option is parsed) - Loop,Parse,Options,= ; parse options string at "="s, needs better whitespace handling - { - If A_Index = 1 ; first option handling - Option := A_LoopField ; sets options VarName - Else ; for the rest after the first, - { ; split at the last space, apply the first chunk to the VarValue for the last Option - %Option% := SubStr(A_LoopField, 1, (pos := InStr(A_LoopField, A_Space, false, 0))-1) - Option := SubStr(A_LoopField, pos+1) ; and set the next option to the last chunk (from the last space to the "=") - } - } - If Wait <> ; option Wait=ID used, normal Notify window not being created - { - If Wait Is Number ; waits for a specific notify - { - Gui %Wait%:+LastFound ; i'd like to remove this to not affect calling script... - If NotifyGuiID := WinExist() ; but think i have to use hWnd's for reference instead of gui numbers which will - { ; probably happen in my AHK_L transition since gui numbers won't matter anymore - WinWaitClose, , , % Abs(Duration) ; wait to close for duration - If (ErrorLevel && Duration < 1) ; destroys window when done waiting if duration is negative - { ; otherwise lets the calling script procede after waiting the duration (without destroying) - Gui, % Wait + GL - GF + 1 ":Destroy" ; destroys border gui - If ST - DllCall("AnimateWindow","UInt",NotifyGuiID,"Int",ST,"UInt","0x00050001") ; slides window out to the right if ST or SC are used - Gui, %Wait%:Destroy ; and destroys it - } - } - } - Else ; wait for all notify's if "Wait=All" is used in the options string - { ; loops through all existing notify's and performs the same wait logic - Loop, % GL-GF ; (with or without destroying if negative or not) - { - Wait := A_Index + GF - 1 - Gui %Wait%:+LastFound - If NotifyGuiID := WinExist() - { - WinWaitClose, , , % Abs(Duration) - If (ErrorLevel && Duration < 1) - { - Gui, % Wait + GL - GF + 1 ":Destroy" ; destroys border gui - If ST - DllCall("AnimateWindow","UInt",NotifyGuiID,"Int",ST,"UInt","0x00050001") ; slides window out to the right if ST or SC are used - Gui, %Wait%:Destroy ; and destroys it - } - } - } - GNList := ACList := ATList := AXList := "" ; clears internal variables since they're all destroyed now - } - Return - } - If Update <> ; option "Update=ID" being used, Notify window will not be created - { ; title, message, image and progress position can be updated - If Title <> - GuiControl, %Update%:,_Title_,%Title% - If Message <> - GuiControl, %Update%:,_Message_,%Message% - If Duration <> - GuiControl, %Update%:,_Progress_,%Duration% - If Image <> - GuiControl, %Update%:,_Image_,%Image% - If Wallpaper <> - GuiControl, %Update%:,_Wallpaper_,%Image% - Return - } - If Style = Save ; option "Style=Save" is used to save the existing window style - { ; and call it back later with "Style=Load" - Saved := Options " GC=" GC " GR=" GR " GT=" GT " BC=" BC " BK=" BK " BW=" BW " BR=" BR " BT=" BT " BF=" BF - Saved .= " TS=" TS " TW=" TW " TC=" TC " TF=" TF " MS=" MS " MW=" MW " MC=" MC " MF=" MF - Saved .= " IW=" IW " IH=" IH " IN=" IN " PW=" PW " PH=" PH " PC=" PC " PB=" PB " XC=" XC " XS=" MS " XW=" XW - Saved .= " SI=" SI " SC=" SC " ST=" ST " WF=" Image " IF=" IF - } ; this needs some major improvement to have multiple saved instead of just one, otherwise pointless - If Return <> - Return, % (%Return%) - If Style <> ; option "Style=Default will reset all variables back to defaults... except options also specified - { ; so "Style=Default GC=Blue" is allowed, which will reset all defaults and then set GC=Blue - If Style = Default - Return % Notify(Title,Message,Duration, ; maybe handled poorly by calling itself, but it saves having to have the defaults set in two areas... thoughts? -( -"GC= GR= GT= BC= BK= BW= BR= BT= BF= TS= TW= TC= TF= - MS= MW= MC= MF= SI= ST= SC= IW= - IH= IN= XC= XS= XW= PC= PB= " Options "Style=") -) ; below are more internally saved styles, which may move to an auxiliary function at some point, but could use some improvement - Else If Style = ToolTip - Return % Notify(Title,Message,Duration,"SI=50 GC=FFFFAA BC=00000 GR=0 BR=0 BW=1 BT=255 TS=8 MS=8 " Options "Style=") - Else If Style = BalloonTip - Return % Notify(Title,Message,Duration,"SI=350 GC=FFFFAA BC=00000 GR=13 BR=15 BW=1 BT=255 TS=10 MS=8 AX=1 XC=999922 IN=8 Image=" A_WinDir "\explorer.exe " Options "Style=") - Else If Style = Error - Return % Notify(Title,Message,Duration,"SI=250 GC=Default BC=00000 GR=0 BR=0 BW=1 BT=255 TS=12 MS=12 AX=1 XC=666666 IN=10 IW=32 IH=32 Image=" A_WinDir "\explorer.exe " Options "Style=") - Else If Style = Warning - Return % Notify(Title,Message,Duration,"SI=250 GC=Default BC=00000 GR=0 BR=0 BW=1 BT=255 TS=12 MS=12 AX=1 XC=666666 IN=9 IW=32 IH=32 Image=" A_WinDir "\explorer.exe " Options "Style=") - Else If Style = Info - Return % Notify(Title,Message,Duration,"SI=250 GC=Default BC=00000 GR=0 BR=0 BW=1 BT=255 TS=12 MS=12 AX=1 XC=666666 IN=8 IW=32 IH=32 Image=" A_WinDir "\explorer.exe " Options "Style=") - Else If Style = Question - Return % Notify(Title,Message,Duration,"SI=250 GC=Default BC=00000 GR=0 BR=0 BW=1 BT=255 TS=12 MS=12 AX=1 XC=666666 Image=24 IW=32 IH=32 " Options "Style=") - Else If Style = Progress - Return % Notify(Title,Message,Duration,"SI=100 GC=Default BC=00000 GR=9 BR=13 BW=2 BT=105 TS=10 MS=10 PG=100 PH=10 GW=300 " Options "Style=") - Else If Style = Huge - Return % Notify(Title,Message,Duration,"SI=100 ST=200 SC=200 GC=FFFFAA BC=00000 GR=27 BR=39 BW=6 BT=105 TS=24 MS=22 " Options "Style=") - Else If Style = Load - Return % Notify(Title,Message,Duration,Saved) - } - } -;������ end if options ���������������������������������������������������������������������������� - - GC_ := GC_<>"" ? GC_ : GC := GC<>"" ? GC : "FFFFAA" ; defaults are set here, and static overrides are used and saved - GR_ := GR_<>"" ? GR_ : GR := GR<>"" ? GR : 9 ; and non static options (with OP_=) are used but not saved - GT_ := GT_<>"" ? GT_ : GT := GT<>"" ? GT : "Off" - BC_ := BC_<>"" ? BC_ : BC := BC<>"" ? BC : "000000" - BK_ := BK_<>"" ? BK_ : BK := BK<>"" ? BK : "Silver" - BW_ := BW_<>"" ? BW_ : BW := BW<>"" ? BW : 2 - BR_ := BR_<>"" ? BR_ : BR := BR<>"" ? BR : 13 - BT_ := BT_<>"" ? BT_ : BT := BT<>"" ? BT : 105 - BF_ := BF_<>"" ? BF_ : BF := BF<>"" ? BF : 350 - TS_ := TS_<>"" ? TS_ : TS := TS<>"" ? TS : 10 - TW_ := TW_<>"" ? TW_ : TW := TW<>"" ? TW : 625 - TC_ := TC_<>"" ? TC_ : TC := TC<>"" ? TC : "Default" - TF_ := TF_<>"" ? TF_ : TF := TF<>"" ? TF : "Default" - MS_ := MS_<>"" ? MS_ : MS := MS<>"" ? MS : 10 - MW_ := MW_<>"" ? MW_ : MW := MW<>"" ? MW : "Default" - MC_ := MC_<>"" ? MC_ : MC := MC<>"" ? MC : "Default" - MF_ := MF_<>"" ? MF_ : MF := MF<>"" ? MF : "Default" - SI_ := SI_<>"" ? SI_ : SI := SI<>"" ? SI : 0 - SC_ := SC_<>"" ? SC_ : SC := SC<>"" ? SC : 0 - ST_ := ST_<>"" ? ST_ : ST := ST<>"" ? ST : 0 - IW_ := IW_<>"" ? IW_ : IW := IW<>"" ? IW : 32 - IH_ := IH_<>"" ? IH_ : IH := IH<>"" ? IH : 32 - IN_ := IN_<>"" ? IN_ : IN := IN<>"" ? IN : 0 - XF_ := XF_<>"" ? XF_ : XF := XF<>"" ? XF : "Arial Black" - XC_ := XC_<>"" ? XC_ : XC := XC<>"" ? XC : "Default" - XS_ := XS_<>"" ? XS_ : XS := XS<>"" ? XS : 12 - XW_ := XW_<>"" ? XW_ : XW := XW<>"" ? XW : 800 - PC_ := PC_<>"" ? PC_ : PC := PC<>"" ? PC : "Default" - PB_ := PB_<>"" ? PB_ : PB := PB<>"" ? PB : "Default" - - wPW := ((PW<>"") ? ("w" PW) : ("")) ; needs improvement, poor handling of explicit sizes and progress widths - hPH := ((PH<>"") ? ("h" PH) : ("")) - If GW <> - { - wGW = w%GW% - wPW := "w" GW - 20 - } - hGH := ((GH<>"") ? ("h" GH) : ("")) - wGW_ := ((GW<>"") ? ("w" GW - 20) : ("")) - hGH_ := ((GH<>"") ? ("h" GH - 20) : ("")) -;������������������������������������������������������������������������ - If Duration = ; default if duration is not used or set to "" - Duration = 30 - GN := GF ; find the next available gui number to use, starting from GF (default 50) - Loop ; within the defined range GF to GL - IfNotInString, GNList, % "|" GN - Break - Else - If (++GN > GL) ;=== too many notifications open, returns 0, handle this error in the calling script - Return 0 ; this is uncommon as the screen is too cluttered by this point anyway - GNList .= "|" GN - GN2 := GN + GL - GF + 1 - - If AC <> ; saves the action to be used when clicked or timeout (or x-button is clicked) - ACList .= "|" GN "=" AC ; need to add different clicks for Title, Message, Image as well - If AT <> ; saved internally in a list, then parsed by the timer or click routine - ATList .= "|" GN "=" AT ; to run the script-side subroutine/label "AC=LabelName" - If AX <> - AXList .= "|" GN "=" AX - - - P_DHW := A_DetectHiddenWindows ; start finding location based on what other Notify() windows are on the screen - P_TMM := A_TitleMatchMode ; saved to restore these settings after changing them, so the calling script won't know - DetectHiddenWindows On ; as they are needed to find all as they are being made as well... or hidden for some reason... - SetTitleMatchMode 1 ; and specific window title match is a little more failsafe - If (WinExist("_Notify()_GUI_")) ;=== find all Notifications from ALL scripts, for placement - WinGetPos, OtherX, OtherY ;=== change this to a loop for all open notifications and find the highest? - DetectHiddenWindows %P_DHW% ;=== using the last Notify() made at this point, which may be better - SetTitleMatchMode %P_TMM% ; and the global settings are restored for the calling thread - - Gui, %GN%:-Caption +ToolWindow +AlwaysOnTop -Border ; here begins the creation of the window - Gui, %GN%:Color, %GC_% ; with the logic to add or not add certain controls, Wallpaper, Image, Title, Progress, Message - If FileExist(WP) ; and some placement logic depending if they are used or not... could definitely be improved - { - Gui, %GN%:Add, Picture, x0 y0 w0 h0 v_Wallpaper_, % WP ; wallpaper added first, stretched to size later - ImageOptions = x+8 y+4 - } - If Image <> ; icon image added next, sized, and spacing added for whats next - { - If FileExist(Image) - Gui, %GN%:Add, Picture, w%IW_% h%IH_% Icon%IN_% v_Image_ %ImageOptions%, % Image - Else - Gui, %GN%:Add, Picture, w%IW_% h%IH_% Icon%Image% v_Image_ %ImageOptions%, %A_WinDir%\system32\shell32.dll - ImageOptions = x+10 - } - If Title <> ; title text control added next, if used - { - Gui, %GN%:Font, w%TW_% s%TS_% c%TC_%, %TF_% - Gui, %GN%:Add, Text, %ImageOptions% BackgroundTrans v_Title_, % Title - } - If PG ; then the progress bar, if called for - Gui, %GN%:Add, Progress, Range0-%PG% %wPW% %hPH% c%PC_% Background%PB_% v_Progress_ - Else - If ((Title) && (Message)) ; some spacing tweaks if both used - Gui, %GN%:Margin, , -5 - If Message <> ; and finally the message text control if used - { - Gui, %GN%:Font, w%MW_% s%MS_% c%MC_%, %MF_% - Gui, %GN%:Add, Text, BackgroundTrans v_Message_, % Message - } - If ((Title) && (Message)) ; final spacing - Gui, %GN%:Margin, , 8 - Gui, %GN%:Show, Hide %wGW% %hGH%, _Notify()_GUI_ ; final sizing - Gui %GN%:+LastFound ; would like to get rid of this to prevent calling script being affected - WinGetPos, GX, GY, GW, GH ; final positioning - GuiControl, %GN%:, _Wallpaper_, % "*w" GW " *h" GH " " WP ; stretch that wallpaper to size - GuiControl, %GN%:MoveDraw, _Title_, % "w" GW-20 " h" GH-10 ; poor handling of text wrapping when gui has explicit size called - GuiControl, %GN%:MoveDraw, _Message_, % "w" GW-20 " h" GH-10 ; needs improvement (and if image is used or not) - If AX <> ; add the corner "X" for closing with a different action than otherwise clicked - { - GW += 10 - Gui, %GN%:Font, w%XW_% s%XS_% c%XC_%, Arial Black ; � (multiply) is the character used for the X-Button - Gui, %GN%:Add, Text, % "x" GW-15 " y-2 Center w12 h20 g_Notify_Kill_" GN - GF + 1, � - } - Gui, %GN%:Add, Text, x0 y0 w%GW% h%GH% BackgroundTrans g_Notify_Action_Clicked_ ; to catch clicks anywhere on the gui - If (GR_) ; may have to be removed for seperate title/message/etc actions - WinSet, Region, % "0-0 w" GW " h" GH " R" GR_ "-" GR_ - If (GT_) ; non-functioning GT option, since the border gui gets in the way - WinSet, Transparent, % GT_ ; will be addressed someday, leaving it in - - SysGet, Workspace, MonitorWorkArea ; positioning - NewX := WorkSpaceRight-GW-5 - If (OtherY) - NewY := OtherY-GH-2-BW_*2 - Else - NewY := WorkspaceBottom-GH-5 - If NewY < % WorkspaceTop - NewY := WorkspaceBottom-GH-5 - - Gui, %GN2%:-Caption +ToolWindow +AlwaysOnTop -Border +E0x20 ; border gui - Gui, %GN2%:Color, %BC_% - Gui %GN2%:+LastFound - If (BR_) - WinSet, Region, % "0-0 w" GW+(BW_*2) " h" GH+(BW_*2) " R" BR_ "-" BR_ - If (BT_) - WinSet, Transparent, % BT_ - - Gui, %GN2%:Show, % "Hide x" NewX-BW_ " y" NewY-BW_ " w" GW+(BW_*2) " h" GH+(BW_*2), _Notify()_BGGUI_ ; actual creation of border gui! but still not shown - Gui, %GN%:Show, % "Hide x" NewX " y" NewY " w" GW, _Notify()_GUI_ ; actual creation of Notify() gui! but still not shown - Gui %GN%:+LastFound ; need to get rid of this so calling script isn't affected - If SI_ - DllCall("AnimateWindow","UInt",WinExist(),"Int",SI_,"UInt","0x00040008") ; animated in, if SI is used - Else - Gui, %GN%:Show, NA, _Notify()_GUI_ ; otherwise, just shown - Gui, %GN2%:Show, NA, _Notify()_BGGUI_ ; and the border shown - WinSet, AlwaysOnTop, On ; and set to Always on Top - - If ((Duration < 0) OR (Duration = "-0")) ; saves internally that ExitApp should happen when this - Exit := GN ; notify dissappears - If (Duration) - SetTimer, % "_Notify_Kill_" GN - GF + 1, % - Abs(Duration) * 1000 ; timer set depending on Duration parameter - Else - SetTimer, % "_Notify_Flash_" GN - GF + 1, % BF_ ; timer set to flash border if the Notify has 0 (infinite) duration - -Return %GN% ; end of Notify(), returns Gui ID number used - -;========================================================================== -;========================================== when a notification is clicked: -_Notify_Action_Clicked_: ; option AC=Label means Label: subroutine will be called here when clicked - ; Critical - SetTimer, % "_Notify_Kill_" A_Gui - GF + 1, Off - Gui, % A_Gui + GL - GF + 1 ":Destroy" - If SC - { - Gui, %A_Gui%:+LastFound - DllCall("AnimateWindow","UInt",WinExist(),"Int",SC,"UInt", "0x00050001") - } - Gui, %A_Gui%:Destroy - If (ACList) - Loop,Parse,ACList,| - If ((Action := SubStr(A_LoopField,1,2)) = A_Gui) - { - Temp_Notify_Action:= SubStr(A_LoopField,4) - StringReplace, ACList, ACList, % "|" A_Gui "=" Temp_Notify_Action, , All - If IsLabel(_Notify_Action := Temp_Notify_Action) - Gosub, %_Notify_Action% - _Notify_Action = - Break - } - StringReplace, GNList, GNList, % "|" A_Gui, , All - SetTimer, % "_Notify_Flash_" A_Gui - GF + 1, Off - If (Exit = A_Gui) - ExitApp -Return - -;========================================================================== -;=========================================== when a notification times out: -_Notify_Kill_1: -_Notify_Kill_2: ; this needs a different method, too many labels -_Notify_Kill_3: ; they are used for Timers, different for each Notify() based on duration... -_Notify_Kill_4: -_Notify_Kill_5: -_Notify_Kill_6: -_Notify_Kill_7: -_Notify_Kill_8: -_Notify_Kill_9: -_Notify_Kill_10: -_Notify_Kill_11: -_Notify_Kill_12: -_Notify_Kill_13: -_Notify_Kill_14: -_Notify_Kill_15: -_Notify_Kill_16: -_Notify_Kill_17: -_Notify_Kill_18: -_Notify_Kill_19: -_Notify_Kill_20: -_Notify_Kill_21: -_Notify_Kill_22: -_Notify_Kill_23: -_Notify_Kill_24: -_Notify_Kill_25: - Critical - StringReplace, GK, A_ThisLabel, _Notify_Kill_ - SetTimer, _Notify_Flash_%GK%, Off - GK := GK + GF - 1 - Gui, % GK + GL - GF + 1 ":Destroy" - If ST - { - Gui, %GK%:+LastFound - DllCall("AnimateWindow","UInt",WinExist(),"Int",ST,"UInt", "0x00050001") - } - Gui, %GK%:Destroy - StringReplace, GNList, GNList, % "|" GK, , All - If (Exit = GK) - ExitApp -Return 1 - -;========================================================================== -;======================================== flashes a permanent notification: -_Notify_Flash_1: -_Notify_Flash_2: -_Notify_Flash_3: -_Notify_Flash_4: ; this needs a different method, too many labels -_Notify_Flash_5: ; they are used for Timers, different for each Notify() based on flash speed... -_Notify_Flash_6: ; when duration is 0 (infinite) -_Notify_Flash_7: ; this may feature may be removed completely, Update given the ability to affect GC and BC -_Notify_Flash_8: ; and then the flashing could be handled script-side via returned gui number and a script-side timer -_Notify_Flash_9: -_Notify_Flash_10: -_Notify_Flash_11: -_Notify_Flash_12: -_Notify_Flash_13: -_Notify_Flash_14: -_Notify_Flash_15: -_Notify_Flash_16: -_Notify_Flash_17: -_Notify_Flash_18: -_Notify_Flash_19: -_Notify_Flash_20: -_Notify_Flash_21: -_Notify_Flash_22: -_Notify_Flash_23: -_Notify_Flash_24: -_Notify_Flash_25: - StringReplace, FlashGN, A_ThisLabel, _Notify_Flash_ - FlashGN += GF - 1 - FlashGN2 := FlashGN + GL - GF + 1 - If Flashed%FlashGN2% := !Flashed%FlashGN2% - Gui, %FlashGN2%:Color, %BK% - Else - Gui, %FlashGN2%:Color, %BC% -Return -} diff --git a/WindowPadX/icons/WindowPad.ico b/WindowPadX/icons/WindowPad.ico deleted file mode 100644 index 184c067..0000000 Binary files a/WindowPadX/icons/WindowPad.ico and /dev/null differ diff --git a/WindowPadX/icons/disabled.ico b/WindowPadX/icons/disabled.ico deleted file mode 100644 index 01aef99..0000000 Binary files a/WindowPadX/icons/disabled.ico and /dev/null differ diff --git a/WindowPadX/icons/disabled_orig.ico b/WindowPadX/icons/disabled_orig.ico deleted file mode 100644 index 1f9fc41..0000000 Binary files a/WindowPadX/icons/disabled_orig.ico and /dev/null differ diff --git a/WindowPadX/icons/minus.png b/WindowPadX/icons/minus.png deleted file mode 100644 index dd1068d..0000000 Binary files a/WindowPadX/icons/minus.png and /dev/null differ diff --git a/WindowPadX/icons/plus.png b/WindowPadX/icons/plus.png deleted file mode 100644 index e90fcd2..0000000 Binary files a/WindowPadX/icons/plus.png and /dev/null differ diff --git a/WindowPadX/icons/tray.ico b/WindowPadX/icons/tray.ico deleted file mode 100644 index 8b4a943..0000000 Binary files a/WindowPadX/icons/tray.ico and /dev/null differ diff --git a/WindowPadX/icons/tray_orig.ico b/WindowPadX/icons/tray_orig.ico deleted file mode 100644 index 17d54ae..0000000 Binary files a/WindowPadX/icons/tray_orig.ico and /dev/null differ