├── .gitignore ├── .gitmodules ├── ChangeLog.md ├── Examples ├── Mousy │ ├── Confine.ahk │ ├── Move.ahk │ ├── Speed.ahk │ └── Trail.ahk ├── WindLy │ ├── Windly_Demo01_Basic.ahk │ ├── Windly_Demo02_Intersection.ahk │ ├── Windly_Demo03_union.ahk │ ├── Windly_Demo04_difference.ahk │ └── Windly_Demo05_symmetricdifference.ahk └── Windy │ ├── clickthrough.ahk │ └── moveBorder.ahk ├── LICENSE ├── Readme.md ├── YUnit_Mony.ahk ├── YUnit_Mousy.ahk ├── YUnit_MultiMony.ahk ├── YUnit_Pointy.ahk ├── YUnit_Recty.ahk ├── YUnit_Windy.ahk ├── YUnit_Windy_Fade.ahk ├── _build ├── MakeDist.ahk ├── _inc │ └── BuildTools.ahk ├── gitlog2md.pl └── mkDoc.bat └── lib ├── DbgOut.ahk ├── SerDes.ahk ├── Windy.ahk └── Windy ├── Const_WinUser.ahk ├── Mony.ahk ├── Mousy.ahk ├── MultiMony.ahk ├── Pointy.ahk ├── Recty.ahk ├── WindLy.ahk ├── Windy.ahk └── _WindowHandlerEvent.ahk /.gitignore: -------------------------------------------------------------------------------- 1 | Demos 2 | Ideas 3 | _WIP_ 4 | _Unused_ 5 | lib/EDE-doc/ 6 | lib/WindowHandler-doc/ 7 | *.lnk 8 | /HotkeyHelp.ahk 9 | ForcePull_Local.sh 10 | NCHITTEST.ahk 11 | backup/ 12 | *.bak 13 | AHK-EDE.tdl 14 | xx.ahk 15 | _build/Net-Github/ 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "YUnit"] 2 | path = YUnit 3 | url = https://github.com/Uberi/Yunit.git 4 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | #Changelog for AHK-Windy 2 | 3 | (on Branch: **master**, since **2014-10-26**) 4 | 5 | ----------------------------------------------------------------- 6 | * **Windy 0.15.3** (via Commit [0bee43c](https://github.com/hoppfrosch/AHK_Windy/commit/0bee43c85e119d5fe0b89a3d8418dd899e387b85)) 7 | * [#37](https://github.com/hoppfrosch/AHK_EDE/issues/37) - Windy: Correct name of property resizeable[] to resizable[] 8 | * *[#41](https://github.com/hoppfrosch/AHK_EDE/issues/41) - INTERNAL: Readme.md: Update with several Badges* 9 | * *[#42](https://github.com/hoppfrosch/AHK_EDE/issues/42) - INTERNAL: Refactor for NaturalDocs 2.0* 10 | * *[#43](https://github.com/hoppfrosch/AHK_EDE/issues/43) - INTERNAL: Recty: Use property feature from AutoHotkey 1.1.16* 11 | * **Windy 0.15.2** (via Commit [5806935](https://github.com/hoppfrosch/AHK_Windy/commit/58069359d270c844e83744eab3d84756aff0c7b9)) 12 | * [#26](https://github.com/hoppfrosch/AHK_EDE/issues/26): WindLy: Methods for Operations (Set-operations, Insert, Remove ...) 13 | * [#33](https://github.com/hoppfrosch/AHK_EDE/issues/33): WindLy: Remove non existing windows from list 14 | * **Windy 0.15.1** (via Commit [a257c27](https://github.com/hoppfrosch/AHK_Windy/commit/a257c2700c4b0eb0b3521f0232bb8324fbb3e988)) 15 | * *INTERNAL: Added Waffle.io Badge to Readme.md* 16 | * **Windy 0.15.0** (via Commit [6389c32](https://github.com/hoppfrosch/AHK_Windy/commit/6389c32ae349d26e2860851795b5c7006373fe9b)) 17 | * [#22](https://github.com/hoppfrosch/AHK_EDE/issues/22) - Windy: new method moveBorder() 18 | * [#24](https://github.com/hoppfrosch/AHK_EDE/issues/24) - Mony: Transform coordinates into screen percents 19 | * [#25](https://github.com/hoppfrosch/AHK_EDE/issues/25) - Windy: Transform current window PosSize into screen percents 20 | * **Merge pull request [#23](https://github.com/hoppfrosch/AHK_EDE/issues/23) from hi5/patch-1** (via Commit [e996f2d](https://github.com/hoppfrosch/AHK_Windy/commit/e996f2d3fc30ddbdea8926a2d8d7ddaf68f68551)) 21 | * Added restore settings line before exit app 22 | * **Windy 0.14.0** (via Commit [59848e1](https://github.com/hoppfrosch/AHK_Windy/commit/59848e1713c07e8619f971c2aa332c941f42391d)) 23 | * [#17](https://github.com/hoppfrosch/AHK_EDE/issues/17) - Make usage of %A_LineFile% to get better include-behaviour 24 | * [#18](https://github.com/hoppfrosch/AHK_EDE/issues/18) - Windy: Setting transparency fails on windows without caption 25 | * [#19](https://github.com/hoppfrosch/AHK_EDE/issues/19) - Windy: Property scale[] for proportional Resizing when moving monitor 26 | * [#20](https://github.com/hoppfrosch/AHK_EDE/issues/20) - Windy: Consider Property scale in Property monitorId 27 | * [#21](https://github.com/hoppfrosch/AHK_EDE/issues/21) - WindLy: Remove unneeded output to messagebox 28 | * **Windy 0.13.0** (via Commit [35795da](https://github.com/hoppfrosch/AHK_Windy/commit/35795da9bda44dda986765df87ed534eadab10bf)) 29 | * [#16](https://github.com/hoppfrosch/AHK_EDE/issues/16) - WindLy: Iniitial Implementation of class for handling window lists 30 | * **Windy 0.12.3** (via Commit [2f9f578](https://github.com/hoppfrosch/AHK_Windy/commit/2f9f578272bbc99c1a73a5db045c927b2c98f388)) 31 | * [#15](https://github.com/hoppfrosch/AHK_EDE/issues/15) - MultiMony: idFromMouse-Property does not work correctly 32 | * [#14](https://github.com/hoppfrosch/AHK_EDE/issues/14) - Mousy: Method locate() destroys other GUI's 33 | * **Windy 0.12.2** (via Commit [3fef096](https://github.com/hoppfrosch/AHK_Windy/commit/3fef096750cb4c909c78f47c248d687bc11df680)) 34 | * [#11](https://github.com/hoppfrosch/AHK_EDE/issues/11) - Mousy - Property speed 35 | * [#12](https://github.com/hoppfrosch/AHK_EDE/issues/12) - Mousy - Property trace 36 | * [#13](https://github.com/hoppfrosch/AHK_EDE/issues/13) - Mousy - Enhance mouse-movement functionality 37 | * **Windy 0.12.1** (via Commit [d2dc603](https://github.com/hoppfrosch/AHK_Windy/commit/d2dc603219982bdda26fbc8835fef1fba54d851f)) 38 | * [+] [#10](https://github.com/hoppfrosch/AHK_EDE/issues/10) - Confine/Restrict mouse to be fenced in a given Rectangle 39 | * **Windy 0.12.0** (via Commit [307b36a](https://github.com/hoppfrosch/AHK_Windy/commit/307b36ab259e09e65d270b49d73a220c14943cee)) 40 | * *[#9](https://github.com/hoppfrosch/AHK_EDE/issues/9) - Reorganization: Rename Dispy.ahk to Mony.ahk and MultiDispy.ahk to MultiMony.ahk (INTERN)* 41 | * **Windy 0.11.1** (via Commit [a1477b4](https://github.com/hoppfrosch/AHK_Windy/commit/a1477b4b6f73d13aefe3f6f8a1fbc23f749d9f42)) 42 | * [#8](https://github.com/hoppfrosch/AHK_EDE/issues/8) - Dispy/MultiDispy - Incorporate functionality/ideas from MDMF (http://ahkscript.org/boards/viewtopic.php?f=6&t=4606) 43 | * **Windy 0.11.0** (via Commit [bf51576](https://github.com/hoppfrosch/AHK_Windy/commit/bf51576e472bf281eead7ad4d874cbb89f58a72e)) 44 | * [#7](https://github.com/hoppfrosch/AHK_EDE/issues/7) - Mony/Dispy/MultiDispy: Replaced Mony.ahk with MultiDispy.ahk and Dispy.ahk 45 | * **Windy 0.10.1** (via Commit [f4bfda4](https://github.com/hoppfrosch/AHK_Windy/commit/f4bfda498d64f02496e0020cdcb74ab3835f8c85)) 46 | * *[#4](https://github.com/hoppfrosch/AHK_EDE/issues/4) - Add link to gh-pages in Readme.md (INTERN)* 47 | * *[#5](https://github.com/hoppfrosch/AHK_EDE/issues/5) - Mony: Use new property feature from AutoHotkey 1.1.16 (INTERN)* 48 | * [#6](https://github.com/hoppfrosch/AHK_EDE/issues/6) - Mony: Show MonitorIds 49 | * **Windy 0.10.0** (via Commit [c6c7e54](https://github.com/hoppfrosch/AHK_Windy/commit/c6c7e54eb32a91883fbb31bfd083abd0c263da7a)) 50 | * *[#1](https://github.com/hoppfrosch/AHK_EDE/issues/1) - Migration from AHK_EDE (INTERN)* 51 | * *[#2](https://github.com/hoppfrosch/AHK_EDE/issues/2) - Setup gh-pages (INTERN)* 52 | * *[#3](https://github.com/hoppfrosch/AHK_EDE/issues/3) - Rename folder EDE to Windy (INTERN)* 53 | * **Merge branch 'master' of github.com:hoppfrosch/AHK_Windy** (via Commit [eb1127f](https://github.com/hoppfrosch/AHK_Windy/commit/eb1127f8634a05cde68a802843113a95fda86784)) 54 | 55 | -------------------------------------------------------------------------------- /Examples/Mousy/Confine.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include Recty.ahk 3 | #include Windy.ahk 4 | 5 | obj := new Mousy() 6 | 7 | obj.confine := false 8 | sleep, 1000 9 | obj.confineRect := new Recty(100,100,200,200) 10 | obj.confine := true 11 | sleep, 10000 12 | obj.confine := false 13 | sleep, 1000 14 | obj.confineRect := new Recty(500,500,700,700) 15 | obj.confine := true 16 | sleep, 10000 17 | obj.confine := false 18 | sleep, 1000 19 | 20 | 21 | -------------------------------------------------------------------------------- /Examples/Mousy/Move.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include Mousy.ahk 3 | 4 | obj := new Mousy() 5 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 6 | obj.x := 100 7 | obj.y := 100 8 | obj.movespeed := 25 9 | obj.speed := 10 10 | obj.movemode := 1 11 | obj.x :=1000 12 | obj.movemode := 3 13 | obj.pos := new Pointy(500,500) 14 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 15 | ExitApp -------------------------------------------------------------------------------- /Examples/Mousy/Speed.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include Mousy.ahk 3 | 4 | obj := new Mousy() 5 | obj.speed := 10 6 | saveSpeed := obj.speed 7 | OutputDebug % "Start - " saveSpeed 8 | obj.speed := 1 9 | OutputDebug % "Speed 1 - " obj.speed 10 | Sleep, 10000 11 | obj.speed := 20 12 | OutputDebug % "Speed 2 - " obj.speed 13 | Sleep, 10000 14 | obj.speed := saveSpeed 15 | OutputDebug % "Ende - " obj.speed 16 | 17 | ExitApp -------------------------------------------------------------------------------- /Examples/Mousy/Trail.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include Mousy.ahk 3 | 4 | CoordMode,Mouse,Screen 5 | obj := new Mousy() 6 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 7 | MouseMove, 1,1,50 8 | savetrail := obj.trail 9 | obj.trail := 7 10 | MouseMove, 1000, 1000,50 11 | OutputDebug % obj.trail 12 | obj.trail := 1 13 | MouseMove, 1,1,50 14 | OutputDebug % obj.trail 15 | obj.trail := 4 16 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 17 | obj.trail := savetrail 18 | ExitApp 19 | -------------------------------------------------------------------------------- /Examples/WindLy/Windly_Demo01_Basic.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy\WindLy.ahk 2 | #include %A_ScriptDir%\..\..\lib\Windy\Const_WinUser.ahk 3 | #include %A_ScriptDir%\..\..\lib\DbgOut.ahk 4 | 5 | OutputDebug DBGVIEWCLEAR 6 | 7 | OutputDebug % "******** All Windows **************************************************************************" 8 | x := new WindLy() 9 | for key, data in x.Snapshot() { ; access the window list directly by function call 10 | OutputDebug % data.hwnd ": " data.title "`n" 11 | } 12 | 13 | OutputDebug % "******** removeNonExisting *********************************************************************" 14 | MsgBox % "Close any window and watch, if the window is removed from the list" 15 | x.removeNonExisting() 16 | 17 | OutputDebug % "******** On Monitor 1 *************************************************************************" 18 | x.byMonitorId(1) 19 | for key, data in x.list { ; access the window list via member variable 20 | OutputDebug % data.hwnd ": " data.title "`n" 21 | } 22 | 23 | OutputDebug % "******** Minimized ****************************************************************************" 24 | ww := x.byStyle(WS.MINIMIZE) 25 | for key, data in ww { ; access the window list via helper variable 26 | OutputDebug % data.hwnd ": " data.title "`n" 27 | } 28 | 29 | 30 | 31 | ExitApp 32 | -------------------------------------------------------------------------------- /Examples/WindLy/Windly_Demo02_Intersection.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include WindLy.ahk 3 | #include Windy.ahk 4 | #include ..\DbgOut.ahk 5 | 6 | OutputDebug DBGVIEWCLEAR 7 | 8 | OutputDebug % "******** Start Situation: All windows of monitor 1 *******************" 9 | x := new WindLy(0) 10 | x.byMonitorId(1) 11 | for key, data in x.list { 12 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 13 | } 14 | 15 | 16 | ; Prepare an example list to intersect with (use original list and remove some items ...) 17 | y := x 18 | i := 0 19 | for key, data in y.list.Clone() { ; As y is manipulated within loop, we have to use a list-clone to iterate over 20 | i := i + 1 21 | if (i != 1) { 22 | y.delete(data) 23 | } 24 | } 25 | OutputDebug % "******** WindLy To Intersect *****************************************" 26 | for key, data in y.list { 27 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 28 | } 29 | 30 | 31 | OutputDebug % "############## SET-Operation INTERSECTION: WindLy.intersection() ########################" 32 | ; Determine Intersection between orignal WindLy instance x and newly generated WindLy instance y 33 | x.intersection(y) ; x is intersected with y - the result is stored in x again 34 | OutputDebug % "******** WindLy After Intersection *****************************************" 35 | for key, data in x.list { 36 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 37 | } 38 | 39 | ExitApp 40 | -------------------------------------------------------------------------------- /Examples/WindLy/Windly_Demo03_union.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include WindLy.ahk 3 | #include Windy.ahk 4 | 5 | OutputDebug % "******** All windows on monitor 1 ***********************************************************" 6 | x := new WindLy() 7 | x.byMonitorId(1) 8 | for key, data in x.list { 9 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 10 | } 11 | 12 | OutputDebug % "******** All windows on monitor 2 ***********************************************************" 13 | y:= new WindLy() 14 | y.byMonitorId(2) 15 | for key, data in y.list { 16 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 17 | } 18 | 19 | OutputDebug % "############## SET-Operation UNION: WindLy.union() ######################################" 20 | ; Create Union of WindLy instance x and WindLy instance y 21 | x.union(y) ; x is united with y - the result is stored in x again 22 | OutputDebug % "******** WindLy After Union *******************************************************************" 23 | for key, data in x.list { 24 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 25 | } 26 | 27 | ExitApp 28 | -------------------------------------------------------------------------------- /Examples/WindLy/Windly_Demo04_difference.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include WindLy.ahk 3 | #include Windy.ahk 4 | 5 | OutputDebug % "******** All windows ***********************************************************************" 6 | x := new WindLy() 7 | x.Snapshot() 8 | for key, data in x.list { 9 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 10 | } 11 | 12 | OutputDebug % "******** All windows on monitor 2 ***********************************************************" 13 | y:= new WindLy() 14 | y.byMonitorId(2) 15 | for key, data in y.list { 16 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 17 | } 18 | 19 | OutputDebug % "############## SET-Operation DIFFERENCE: WindLy.difference() ###################################" 20 | ; Create difference of WindLy instance x and WindLy instance y 21 | x.difference(y) ; y is removed from x - the result is stored in x again 22 | OutputDebug % "******** WindLy After Union *******************************************************************" 23 | for key, data in x.list { 24 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 25 | } 26 | 27 | ExitApp 28 | -------------------------------------------------------------------------------- /Examples/WindLy/Windly_Demo05_symmetricdifference.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include WindLy.ahk 3 | #include Windy.ahk 4 | 5 | OutputDebug % "******** All windows on monitor 1 ***********************************************************" 6 | x := new WindLy() 7 | x.byMonitorId(1) 8 | for key, data in x.list { 9 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 10 | } 11 | 12 | OutputDebug % "******** All windows on monitor 2 ***********************************************************" 13 | y:= new WindLy() 14 | y.byMonitorId(2) 15 | for key, data in x.list { ; As y is manipulated within loop, we have to use a list-clone to iterate over 16 | i := i + 1 17 | if (i < 2) { 18 | y.insert(data) 19 | } 20 | } 21 | for key, data in y.list { 22 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 23 | } 24 | 25 | OutputDebug % "############## SET-Operation SYMMETRICDIFFERENCE: WindLy.symmetricDifference() ##################" 26 | ; Create difference of WindLy instance x and WindLy instance y 27 | x.symmetricDifference(y) ; y is removed from x - the result is stored in x again 28 | OutputDebug % "******** WindLy After Union *******************************************************************" 29 | for key, data in x.list { 30 | OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" 31 | } 32 | 33 | ExitApp 34 | -------------------------------------------------------------------------------- /Examples/Windy/clickthrough.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include Windy.ahk 3 | 4 | obj := new Windy(0,0) 5 | 6 | ToolTip, ClickThrough:= 1`nAlwaysOnTop:=1, 100, 150 7 | obj.alwaysontop := 1 8 | obj.clickthrough := 1 9 | sleep 10000 10 | ToolTip, ClickThrough:= 0`nAlwaysOnTop:=0, 100, 150 11 | obj.clickthrough := 0 12 | obj.alwaysontop := 0 13 | sleep 10000 14 | ToolTip 15 | obj.kill() 16 | 17 | ExitApp -------------------------------------------------------------------------------- /Examples/Windy/moveBorder.ahk: -------------------------------------------------------------------------------- 1 | #include %A_ScriptDir%\..\..\lib\Windy 2 | #include Windy.ahk 3 | 4 | arrBorder := ["l","r","hc","t","b","vc", "l t", "l b", "l vc", "r t", "r b", "r vc", "hc t", "hc b", "hc vc"] 5 | obj := new Windy(0,0) 6 | Loop % arrBorder.MaxIndex() { 7 | OutputDebug % "********************************* " arrBorder[A_Index] " ************************************************" 8 | obj.move(200,200) 9 | obj.debug := 1 10 | obj.moveBorder(arrBorder[A_Index]) 11 | obj.debug := 0 12 | sleep 2000 13 | } 14 | obj.kill() 15 | 16 | ExitApp -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See [WTFPL](http://www.wtfpl.net/) for more details. 2 | 3 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # AHK-Windy - Tools to operate on windows [![AutoHotkey](https://img.shields.io/badge/Language-AutoHotkey-yellowgreen.svg)](https://autohotkey.com/) ![](https://img.shields.io/badge/State-Stable-green.svg) 2 | 3 | Functionality for easier work with mouse and windows on desktop. Multi-Monitor support is also provided ... 4 | 5 | Documentation is available on [gh_pages](http://hoppfrosch.github.io/AHK_Windy) 6 | 7 | **Author**: [hoppfrosch@gmx.de](mailto:hoppfrosch@gmx.de) 8 | 9 | ---------- 10 | **Issues**: [![Stories in Backlog](https://badge.waffle.io/hoppfrosch/AHK_Windy.svg?label=backlog&title=Backlog)](http://waffle.io/hoppfrosch/AHK_Windy) [![Stories in Ready](https://badge.waffle.io/hoppfrosch/AHK_Windy.svg?label=ready&title=Ready)](http://waffle.io/hoppfrosch/AHK_Windy) [![Stories in Progress](https://badge.waffle.io/hoppfrosch/AHK_Windy.svg?label=In%20Progress&title=In%20Progress)](http://waffle.io/hoppfrosch/AHK_Windy) [![Stories in Done](https://badge.waffle.io/hoppfrosch/AHK_Windy.svg?label=done&title=Done)](http://waffle.io/hoppfrosch/AHK_Windy) 11 | ---------- 12 | ## Credits 13 | 14 | - [Chris](http://www.autohotkey.com/board/user/2-chris/) 15 | - [AutoHotkey 1.0](http://www.autohotkey.com/) 16 | - [Lexikos](http://www.autohotkey.com/board/user/2446-lexikos/) 17 | - for taking up the development on [AutoHotkey](http://l.autohotkey.net/) (aka. AHK_L) 18 | - [WindowPad](http://http://www.autohotkey.com/board/topic/19990-windowpad-window-moving-tool) as **main inspiration** 19 | 20 | ### Ideas/Implementations as Input 21 | - [Bkid](http://ahkscript.org/boards/memberlist.php?mode=viewprofile&u=55) 22 | - [Identify monitor numbers with IDMonitors()](http://http://ahkscript.org/boards/viewtopic.php?f=6&t=3761&p=19836) 23 | - [joedf](http://ahkscript.org/boards/memberlist.php?mode=viewprofile&u=55) 24 | - [Smart WinFade](http://ahkscript.org/boards/viewtopic.php?f=6&t=512) 25 | - [just me](https://github.com/AHK-just-me) 26 | - [GUI Constants](https://github.com/AHK-just-me/AHK_Gui_Constants) 27 | - Function [API_GetWindowInfo()](http://www.autohotkey.com/board/topic/69254-func-api-getwindowinfo-ahk-l/) 28 | - [MDMF - Multiple Display Monitor Functions](http://ahkscript.org/boards/viewtopic.php?f=6&t=4606) 29 | - [majkinetor](http://www.autohotkey.com/board/user/1763-majkinetor/) 30 | - [Forms-Framework](https://github.com/maul-esel/FormsFramework) 31 | - [ManaUser](http://www.autohotkey.com/board/user/3558-manauser/) 32 | - Function `__isWindow(`) - taken from [AppsKeys](http://www.autohotkey.com/board/topic/25393-appskeys-a-suite-of-simple-utility-hotkeys/) 33 | - [maul-esel](https://github.com/maul-esel) 34 | - porting [Forms Framework](https://github.com/maul-esel/FormsFramework) to AHK_L 35 | - [MasterFocus](https://github.com/MasterFocus) 36 | - Function [RandomBezier](https://github.com/MasterFocus/AutoHotkey/tree/master/Functions/RandomBezier) - moving mouse on a random path (bezier curve) 37 | - [Uberi](http://www.autohotkey.com/board/user/12435-uberi/) 38 | - [Yunit-Framework](https://github.com/Uberi/Yunit) 39 | - **and to everyone I might have forgotten** 40 | 41 | ### Bugfixes 42 | - [WinSet, Transparent fails on AHK GUI -caption ](http://www.autohotkey.com/board/topic/67874-winset-transparent-fails-on-ahk-gui-caption/) 43 | 44 | ### More Inspiration taken from ### 45 | 46 | - [WindowPad](http://http://www.autohotkey.com/board/topic/19990-windowpad-window-moving-tool)/[WindowPadX](https://github.com/hoppfrosch/WindowPadX) - free - based on AutoHotkey as well 47 | - [WindowMenuPlus](http://www.moo0.com/?top=http://www.moo0.com/software/WindowMenuPlus/) - Free (Non-Commercial Use Only) 48 | - [WindowSpace](http://www.ntwind.com/software/windowspace.html) - commercial 49 | - [Winsplit-Revolution](http://winsplit-revolution.com/) - Freeware 50 | 51 | ### Used libraries 52 | - [Coco](https://gist.github.com/cocobelgica) 53 | - [SerDes](https://github.com/cocobelgica/AutoHotkey-SerDes)-Function (Serialize / de-serialize an AutoHotkey object structure) 54 | - [Uberi](http://www.autohotkey.com/board/user/12435-uberi/) 55 | - [Yunit-Framework](https://github.com/Uberi/Yunit) 56 | - **and to everyone I might have forgotten** 57 | 58 | 59 | ### History 60 | 61 | This project was split of [AHK_EDE](https://github.com/hoppfrosch/AHK_EDE/). 62 | 63 | ChangeLog is available [here](https://github.com/hoppfrosch/AHK_Windy/blob/master/ChangeLog.md) 64 | -------------------------------------------------------------------------------- /YUnit_Mony.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv 2 | 3 | #Include %A_ScriptDir%\Yunit\Yunit.ahk 4 | #Include %A_ScriptDir%\Yunit\Window.ahk 5 | #Include %A_ScriptDir%\Yunit\StdOut.ahk 6 | #include 7 | #include 8 | 9 | #Warn All 10 | ;#Warn LocalSameAsGlobal, Off 11 | #SingleInstance force 12 | 13 | 14 | ReferenceVersion := "1.0.1" 15 | debug := 1 16 | 17 | ;Yunit.Use(YunitStdOut, YunitWindow).Test(ExpMonyTestSuite) 18 | Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, MonyTestSuite) 19 | Return 20 | 21 | ExitApp 22 | 23 | 24 | class ExpMonyTestSuite 25 | { 26 | Begin() { 27 | Global debug 28 | ; this.obj := new Mony(1, debug) 29 | this.monCount := 2 30 | this.mon1Width := 1920 31 | this.mon1Height := 1080 32 | this.mon2Width := 1920 33 | this.mon2Height := 1200 34 | } 35 | 36 | rectToPercent() { 37 | Global debug 38 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 39 | mon1 := new Mony(1, debug) 40 | rect := new Recty(this.mon1Width/10,this.mon1Height/10,this.mon1Width/5,this.mon1Height/4) 41 | per := mon1.rectToPercent(rect) 42 | Yunit.assert(per.x == 100/10) 43 | Yunit.assert(per.y == 100/10) 44 | Yunit.assert(per.w == 100/5) 45 | Yunit.assert(per.h == 100/4) 46 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 47 | } 48 | 49 | End() { 50 | ; this.remove("obj") 51 | ; this.obj := 52 | } 53 | 54 | } 55 | 56 | class MonyTestSuite 57 | { 58 | Begin() { 59 | Global debug 60 | ; this.obj := new Mony(1, debug) 61 | this.monCount := 2 62 | this.mon1Width := 1920 63 | this.mon1Height := 1080 64 | this.mon2Width := 1920 65 | this.mon2Height := 1200 66 | } 67 | 68 | _constructor() { 69 | Global debug 70 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 71 | mon1 := new Mony(1, debug) 72 | Yunit.assert(mon1 != false) 73 | mon99 := new Mony(99, debug) 74 | Yunit.assert(mon99 = false) 75 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 76 | } 77 | 78 | boundary() { 79 | Global debug 80 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 81 | mon1 := new Mony(1, debug) 82 | rect1 := mon1.boundary 83 | Yunit.assert(rect1.w == this.mon1Width) 84 | Yunit.assert(rect1.h == this.mon1Height) 85 | mon2 := new Mony(2, debug) 86 | rect2 := mon2.boundary(2) 87 | Yunit.assert(rect2.x == rect1.w) 88 | Yunit.assert(rect2.y == rect2.y) 89 | Yunit.assert(rect2.w == rect1.w + this.mon2Width) 90 | Yunit.assert(rect2.h == this.mon2Height) 91 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 92 | } 93 | 94 | center() { 95 | Global debug 96 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 97 | mon1 := new Mony(1, debug) 98 | pt1 := mon1.center 99 | Yunit.assert(pt1.x == this.mon1Width/2) 100 | Yunit.assert(pt1.y == this.mon1Height/2) 101 | mon2 := new Mony(2, debug) 102 | pt2 := mon2.center 103 | Yunit.assert(pt2.x == (this.mon1Width+(this.mon2Width/2))) 104 | Yunit.assert(pt2.y == this.mon2Height/2) 105 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 106 | } 107 | 108 | coordDisplayToVirtualScreen() { 109 | Global debug 110 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 111 | mon1 := new Mony(1, debug) 112 | pt := mon1.coordDisplayToVirtualScreen(10, 10) 113 | Yunit.assert(pt.x == 10) 114 | Yunit.assert(pt.y == 10) 115 | mon2 := new Mony(2, debug) 116 | pt := mon2.coordDisplayToVirtualScreen(10, 10) 117 | Yunit.assert(pt.x == this.mon1Width + 10) 118 | Yunit.assert(pt.y == 10) 119 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 120 | return 121 | } 122 | 123 | hmon() { 124 | Global debug 125 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 126 | mon1 := new Mony(1, debug) 127 | Yunit.assert(mon1.hmon > 0) 128 | mon2 := new Mony(2, debug) 129 | Yunit.assert(mon2.hmon > 0) 130 | Yunit.assert(mon2.hmon != mon1.hmon) 131 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 132 | return 133 | } 134 | 135 | identify() { 136 | Global debug 137 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 138 | mon1 := new Mony(1, debug) 139 | mon1.identify(250) 140 | mon2 := new Mony(2, debug) 141 | mon2.identify(250) 142 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 143 | } 144 | 145 | idNextPrev() { 146 | Global debug 147 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 148 | 149 | ; Monitor 1 150 | mon1 := new Mony(1, debug) 151 | monNxt := mon1.idNext 152 | Yunit.assert(monNxt == 2) 153 | monNxt := mon1.idNext(0) 154 | Yunit.assert(monNxt == 2) 155 | monNxt := mon1.idNext(1) 156 | Yunit.assert(monNxt == 2) 157 | 158 | monPrv := mon1.idPrev 159 | Yunit.assert(monPrv == 2) 160 | monPrv := mon1.idPrev(0) 161 | Yunit.assert(monPrv == 1) 162 | monPrv := mon1.idPrev(1) 163 | Yunit.assert(monPrv == 2) 164 | 165 | ; Monitor 2 .... 166 | mon2 := new Mony(2, debug) 167 | monNxt := mon2.idNext 168 | Yunit.assert(monNxt == 1) 169 | monNxt := mon2.idNext(0) 170 | Yunit.assert(monNxt == 2) 171 | monNxt := mon2.idNext(1) 172 | Yunit.assert(monNxt == 1) 173 | 174 | monPrv := mon2.idPrev 175 | Yunit.assert(monPrv == 1) 176 | monPrv := mon2.idPrev(0) 177 | Yunit.assert(monPrv == 1) 178 | monPrv := mon2.idPrev(1) 179 | Yunit.assert(monPrv == 1) 180 | 181 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 182 | } 183 | 184 | info() { 185 | Global debug 186 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 187 | mon1 := new Mony(1, debug) 188 | info := mon1.info 189 | bound := mon1.boundary 190 | Yunit.assert(info.boundary.x = bound.x) 191 | Yunit.assert(info.boundary.y = bound.y) 192 | Yunit.assert(info.boundary.w = bound.w) 193 | Yunit.assert(info.boundary.h = bound.h) 194 | mon2 := new Mony(2, debug) 195 | info := mon2.info 196 | bound := mon2.boundary 197 | Yunit.assert(info.boundary.x = bound.x) 198 | Yunit.assert(info.boundary.y = bound.y) 199 | Yunit.assert(info.boundary.w = bound.w) 200 | Yunit.assert(info.boundary.h = bound.h) 201 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 202 | } 203 | 204 | monitorsCount() { 205 | Global debug 206 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 207 | mon1 := new Mony(1, debug) 208 | cnt := mon1.monitorsCount 209 | Yunit.assert(cnt == this.monCount) 210 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 211 | } 212 | 213 | primary() { 214 | Global debug 215 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 216 | mon1 := new Mony(1, debug) 217 | Yunit.assert(mon1.primary = true) 218 | mon2 := new Mony(2, debug) 219 | Yunit.assert(mon2.primary = false) 220 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 221 | } 222 | 223 | rectToPercent() { 224 | Global debug 225 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 226 | mon1 := new Mony(1, debug) 227 | rect := new Recty(this.mon1Width/10,this.mon1Height/10,this.mon1Width/5,this.mon1Height/4) 228 | per := mon1.rectToPercent(rect) 229 | Yunit.assert(per.x == 100/10) 230 | Yunit.assert(per.y == 100/10) 231 | Yunit.assert(per.w == 100/5) 232 | Yunit.assert(per.h == 100/4) 233 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 234 | } 235 | 236 | size() { 237 | Global debug 238 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 239 | mon1 := new Mony(1, debug) 240 | sx := mon1.scaleX(1) 241 | Yunit.assert(sx == 1) 242 | sy := mon1.scaleY(1) 243 | Yunit.assert(sy == 1) 244 | sc := mon1.scale(1) 245 | Yunit.assert(sc.x == 1) 246 | Yunit.assert(sc.y == 1) 247 | 248 | sx := mon1.scaleX(2) 249 | sx := Round(sx*1000)/1000 250 | dx := this.mon2Width/this.mon1Width 251 | dx := Round(dx*1000)/1000 252 | Yunit.assert(Round(sx*1000)/1000 == Round(dx*1000)/1000) 253 | sy := mon1.scaleY(2) 254 | dy := this.mon2Height/this.mon1Height 255 | Yunit.assert(Round(sy*1000)/1000 == Round(dy*1000)/1000) 256 | sc := mon1.scale(2) 257 | Yunit.assert(Round(sx*1000)/1000 == Round(dx*1000)/1000) 258 | Yunit.assert(Round(sy*1000)/1000 == Round(dy*1000)/1000) 259 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 260 | } 261 | 262 | virtualScreenSize() { 263 | Global debug 264 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 265 | mon1 := new Mony(1, debug) 266 | rect := mon1.virtualScreenSize() 267 | Yunit.assert(rect.x == 0) 268 | Yunit.assert(rect.y == 0) 269 | Yunit.assert(rect.w == (this.mon1Width + this.mon2Width)) 270 | Yunit.assert(rect.h == this.mon2Height) 271 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 272 | } 273 | 274 | workingArea() { 275 | Global debug 276 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 277 | mon1 := new Mony(1, debug) 278 | rect := mon1.workingArea 279 | Yunit.assert(rect.w <= this.mon1Width) 280 | Yunit.assert(rect.h <= this.mon1Height) 281 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 282 | } 283 | 284 | End() { 285 | ; this.remove("obj") 286 | ; this.obj := 287 | } 288 | 289 | } 290 | 291 | class _BaseTestSuite { 292 | Begin() { 293 | } 294 | 295 | Version() { 296 | Global debug 297 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 298 | Global ReferenceVersion 299 | iMony := new Mony(1, debug) 300 | OutputDebug % "Mony Version <" iMony.version "> <-> Required <" ReferenceVersion ">" 301 | Yunit.assert(iMony.version == ReferenceVersion) 302 | OutputDebug % ">>>>[" A_ThisFunc "]>>>>" 303 | } 304 | 305 | End() { 306 | } 307 | } 308 | -------------------------------------------------------------------------------- /YUnit_Mousy.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv 2 | #SingleInstance force 3 | 4 | #Include %A_ScriptDir%\Yunit\Yunit.ahk 5 | #Include %A_ScriptDir%\Yunit\Window.ahk 6 | #Include %A_ScriptDir%\Yunit\StdOut.ahk 7 | #include 8 | #include 9 | 10 | #Warn All 11 | #Warn LocalSameAsGlobal, Off 12 | 13 | 14 | debug := 1 15 | ReferenceVersion := "1.1.4" 16 | 17 | ;Yunit.Use(YunitStdOut, YunitWindow).Test(TempTestSuite) 18 | Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, MiscTestSuite) 19 | Return 20 | 21 | class TempTestSuite 22 | { 23 | Begin() { 24 | Global debug 25 | this.r := new Mousy(debug) 26 | } 27 | 28 | move() { 29 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 30 | this.r.x := 100 31 | this.r.y := 100 32 | this.r.movespeed := 25 33 | this.r.movemode := 1 34 | this.r.x :=1000 35 | this.r.movemode := 3 36 | this.r.pos := new Pointy(500,500) 37 | this.r.movemode := 2 38 | this.r.pos := new Pointy(100,100) 39 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 40 | } 41 | 42 | 43 | End() { 44 | this.remove("r") 45 | this.r := 46 | } 47 | 48 | } 49 | 50 | 51 | class MiscTestSuite 52 | { 53 | Begin() { 54 | Global debug 55 | this.r := new Mousy(debug) 56 | } 57 | 58 | Locate() { 59 | Global debug 60 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 61 | this.r.locate() 62 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 63 | } 64 | 65 | monitorID() { 66 | Global debug 67 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 68 | this.r.monitorID := 1 69 | Yunit.assert(this.r.monitorID == 1) 70 | this.r.monitorID := 2 71 | Yunit.assert(this.r.monitorID == 2) 72 | 73 | this.r.x := 100 74 | this.r.y := 100 75 | Yunit.assert(this.r.monitorID == 1) 76 | this.r.x := 2500 77 | Yunit.assert(this.r.monitorID == 2) 78 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 79 | } 80 | 81 | speed() { 82 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 83 | this.r.speed := 10 84 | saveSpeed := this.r.speed 85 | Yunit.assert(this.r.speed == 10) 86 | this.r.speed := 1 87 | Yunit.assert(this.r.speed == 1) 88 | this.r.speed := 20 89 | Yunit.assert(this.r.speed == 20) 90 | this.r.speed := saveSpeed 91 | Yunit.assert(this.r.speed == saveSpeed) 92 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 93 | } 94 | 95 | move() { 96 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 97 | this.r.x := 100 98 | this.r.y := 100 99 | this.r.movespeed := 25 100 | this.r.movemode := 1 101 | this.r.x :=1000 102 | this.r.movemode := 3 103 | this.r.pos := new Pointy(500,500) 104 | this.r.movemode := 2 105 | this.r.pos := new Pointy(100,100) 106 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 107 | } 108 | 109 | End() { 110 | this.remove("r") 111 | this.r := 112 | } 113 | } 114 | 115 | ; Does not work within YUnit-TestSuite :-( 116 | class ProblematicTestSuite 117 | { 118 | Begin() { 119 | Global debug 120 | this.r := new Mousy(debug) 121 | } 122 | 123 | confine() { 124 | ; This UnitTest fails due to failure with YUnit 125 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 126 | this.r.confine := false 127 | this.r.pos(1,1) 128 | pos := this.r.pos 129 | OutputDebug % pos.Dump() 130 | this.r.confineRect := new Recty(100,100,100,100) 131 | this.r.confine := true 132 | this.r.pos(1,1) 133 | pos := this.r.pos 134 | OutputDebug % pos.Dump() 135 | this.r.confine := false 136 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 137 | } 138 | 139 | trail() { 140 | CoordMode,Mouse,Screen 141 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 142 | MouseMove, 1,1,10 143 | savetrail := this.r.trail 144 | this.r.trail := 7 145 | MouseMove, 1000, 1000,10 146 | Yunit.assert(this.r.trail == 7) 147 | this.r.trail := 1 148 | MouseMove, 1,1,10 149 | Yunit.assert(this.r.trail == 1) 150 | this.r.trail := savetrail 151 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 152 | } 153 | 154 | End() { 155 | this.remove("r") 156 | this.r := 157 | } 158 | 159 | } 160 | 161 | 162 | class _BaseTestSuite { 163 | Begin() { 164 | } 165 | 166 | Version() { 167 | Global debug 168 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 169 | Global ReferenceVersion 170 | obj := new Mousy(debug) 171 | OutputDebug % "Mousy Version <" obj.version "> <-> Required <" ReferenceVersion ">" 172 | Yunit.assert(obj.version == ReferenceVersion) 173 | OutputDebug % ">>>>[" A_ThisFunc "]>>>>" 174 | } 175 | 176 | End() { 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /YUnit_MultiMony.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv 2 | 3 | #Include %A_ScriptDir%\Yunit\Yunit.ahk 4 | #Include %A_ScriptDir%\Yunit\Window.ahk 5 | #Include %A_ScriptDir%\Yunit\StdOut.ahk 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #Warn All 12 | ;#Warn LocalSameAsGlobal, Off 13 | #SingleInstance force 14 | 15 | ReferenceVersion := "1.0.2" 16 | debug := 1 17 | 18 | ;Yunit.use(YunitStdOut, YunitWindow).Test(ExpMultiMonyTestSuite) 19 | Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, MultiMonyTestSuite) 20 | Return 21 | 22 | class ExpMultiMonyTestSuite { 23 | Begin() { 24 | Global debug 25 | this.obj := new MultiMony(debug) 26 | this.monCount := 2 27 | this.mon1Width := 1920 28 | this.mon1Height := 1080 29 | this.mon2Width := 1920 30 | this.mon2Height := 1200 31 | 32 | this.monvirtWidth := this.mon1Width + this.mon2Width 33 | this.monvirtHeight := this.mon2Height 34 | } 35 | 36 | monitors() { 37 | Global debug 38 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 39 | mcRef := this.obj.monitorsCount 40 | ; HINT: Test is valid - but makes YUnit to terminate. Therefore it's disabled 41 | mons := this.obj.monitors() 42 | mc := mons.MaxIndex() 43 | Yunit.assert( mcRef == mc) 44 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 45 | } 46 | 47 | End() { 48 | this.remove("obj") 49 | this.obj := 50 | } 51 | } 52 | 53 | class MultiMonyTestSuite 54 | { 55 | Begin() { 56 | Global debug 57 | this.obj := new MultiMony(debug) 58 | this.monCount := 2 59 | this.mon2Width := 1920 60 | this.mon2Height := 1080 61 | this.mon1Width := 1900 62 | this.mon1Height := 1200 63 | 64 | this.monvirtWidth := this.mon1Width + this.mon2Width 65 | this.monvirtHeight := this.mon2Height 66 | } 67 | 68 | idPrimary() { 69 | Global debug 70 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 71 | prim := this.obj.idPrimary 72 | Yunit.assert(prim == 2) 73 | tb := this.obj.idTaskbar 74 | Yunit.assert(tb == prim) 75 | Yunit.assert(tb == 2) 76 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 77 | } 78 | 79 | coordDisplayToVirtualScreen() { 80 | Global debug 81 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 82 | pt := this.obj.coordDisplayToVirtualScreen(1, 10, 10) 83 | Yunit.assert(pt.x == 10) 84 | Yunit.assert(pt.y == 10) 85 | pt := this.obj.coordDisplayToVirtualScreen(2, 10, 10) 86 | Yunit.assert(pt.x == this.mon1Width + 10) 87 | Yunit.assert(pt.y == 10) 88 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 89 | } 90 | coordVirtualScreenToDisplay() { 91 | Global debug 92 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 93 | x := this.obj.coordVirtualScreenToDisplay(10,10) 94 | Yunit.assert(x.monID == 1) 95 | Yunit.assert(x.pt.x == 10) 96 | Yunit.assert(x.pt.y == 10) 97 | x := this.obj.coordVirtualScreenToDisplay(1930,10) 98 | Yunit.assert(x.monID == 2) 99 | Yunit.assert(x.pt.x == 10) 100 | Yunit.assert(x.pt.y == 10) 101 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 102 | } 103 | hmonFromCoord() { 104 | Global debug 105 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 106 | monId := this.obj.idFromCoord(10,10) 107 | hmonRef := this.obj.hmonFromId(monId) 108 | hmon := this.obj.hmonFromCoord(10,10) 109 | Yunit.assert(hmon == hmonRef) 110 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 111 | } 112 | hmonFromId() { 113 | Global debug 114 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 115 | hmonRef := this.obj.hmonFromCoord(10,10) 116 | monId := this.obj.idFromCoord(10,10) 117 | hmon := this.obj.hmonFromId(monId) 118 | Yunit.assert(hmon == hmonRef) 119 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 120 | } 121 | hmonFromRect() { 122 | Global debug 123 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 124 | hmonRef := this.obj.hmonFromId(1) 125 | win := new Windy(0, debug) 126 | win.move(10,10) 127 | rect := win.possize 128 | hmon := this.obj.hmonFromRect(rect.x, rect.y, rect.w, rect.h) 129 | Yunit.assert(hmon == hmonRef) 130 | win.kill() 131 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 132 | } 133 | hmonFromHwnd() { 134 | Global debug 135 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 136 | hmonRef := this.obj.hmonFromId(1) 137 | win := new Windy(0, debug) 138 | win.move(10,10) 139 | hwnd := win.hwnd 140 | hmon := this.obj.hmonFromHwnd(hwnd) 141 | Yunit.assert(hmon == hmonRef) 142 | win.kill() 143 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 144 | } 145 | identify() { 146 | Global debug 147 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 148 | this.obj.identify(250, "00FF00") 149 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 150 | } 151 | idFromCoord() { 152 | Global debug 153 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 154 | mon := this.obj.idFromCoord(10,10) 155 | Yunit.assert(mon == 1) 156 | mon1 := new Mony(1, debug) 157 | rect := mon1.size 158 | mon := this.obj.idFromCoord(rect.w+10,10) 159 | Yunit.assert(mon == 2) 160 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 161 | } 162 | idFromHmon() { 163 | Global debug 164 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 165 | monId := this.obj.idFromCoord(10,10) 166 | monH := this.obj.hmonFromCoord(10,10) 167 | monID2 := this.obj.idFromHmon(monH) 168 | Yunit.assert(monId == monId2) 169 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 170 | } 171 | idFromRect() { 172 | Global debug 173 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 174 | win := new Windy(0, debug) 175 | idRef := 1 176 | win.move(10,10) 177 | rect := win.possize 178 | id := this.obj.idFromRect(rect.x, rect.y, rect.w, rect.h) 179 | Yunit.assert(id == idRef) 180 | win.kill() 181 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 182 | } 183 | idFromHwnd() { 184 | Global debug 185 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 186 | win := new Windy(0, debug) 187 | win.move(10,10) 188 | hwnd := win.hwnd 189 | id := this.obj.idFromHwnd(hwnd) 190 | Yunit.assert(id == 1) 191 | win.kill() 192 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 193 | } 194 | idFromMouse() { 195 | Global debug 196 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 197 | MouseGetPos,x_back,y_back 198 | MouseMove,10,10 199 | mon := this.obj.idFromMouse() 200 | Yunit.assert(mon == 1) 201 | mon1 := new Mony(1, debug) 202 | rect := mon1.size 203 | MouseMove,rect.w+10,10 204 | mon := this.obj.idFromMouse() 205 | Yunit.assert(mon == 2) 206 | MouseMove,x_back, y_back 207 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 208 | } 209 | idNextPrev() { 210 | Global debug 211 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 212 | 213 | ; Monitor 1 214 | monNxt := this.obj.idNext(1) 215 | Yunit.assert(monNxt == 2) 216 | monNxt := this.obj.idNext(1,0) 217 | Yunit.assert(monNxt == 2) 218 | monNxt := this.obj.idNext(1,1) 219 | Yunit.assert(monNxt == 2) 220 | 221 | monPrv := this.obj.idPrev(1) 222 | Yunit.assert(monPrv == 2) 223 | monPrv := this.obj.idPrev(1,0) 224 | Yunit.assert(monPrv == 1) 225 | monPrv := this.obj.idPrev(1, 1) 226 | Yunit.assert(monPrv == 2) 227 | 228 | ; Monitor 2 .... 229 | monNxt :=this.obj.idNext(2) 230 | Yunit.assert(monNxt == 1) 231 | monNxt := this.obj.idNext(2,0) 232 | Yunit.assert(monNxt == 2) 233 | monNxt := this.obj.idNext(2,1) 234 | Yunit.assert(monNxt == 1) 235 | 236 | monPrv := this.obj.idPrev(2) 237 | Yunit.assert(monPrv == 1) 238 | monPrv := this.obj.idPrev(2,0) 239 | Yunit.assert(monPrv == 1) 240 | monPrv := this.obj.idPrev(2,1) 241 | Yunit.assert(monPrv == 1) 242 | 243 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 244 | } 245 | monitors() { 246 | Global debug 247 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 248 | mcRef := this.obj.monitorsCount 249 | mons := this.obj.monitors() 250 | mc := mons.MaxIndex() 251 | Yunit.assert( mcRef == mc) 252 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 253 | } 254 | monitorsCount() { 255 | Global debug 256 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 257 | cnt := this.obj.monitorsCount 258 | Yunit.assert(cnt == this.monCount) 259 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 260 | } 261 | size() { 262 | Global debug 263 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 264 | rect := this.obj.virtualScreenSize 265 | Yunit.assert(rect.x == 0) 266 | Yunit.assert(rect.y == 0) 267 | Yunit.assert(rect.w == this.monvirtWidth) 268 | Yunit.assert(rect.h == this.monvirtHeight) 269 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 270 | } 271 | virtualScreenSize() { 272 | Global debug 273 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 274 | rect := this.obj.size 275 | Yunit.assert(rect.x == 0) 276 | Yunit.assert(rect.y == 0) 277 | Yunit.assert(rect.w == this.monvirtWidth) 278 | Yunit.assert(rect.h == this.monvirtHeight) 279 | OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" 280 | } 281 | 282 | End() { 283 | this.remove("obj") 284 | this.obj := 285 | } 286 | } 287 | 288 | class _BaseTestSuite { 289 | Begin() { 290 | } 291 | 292 | Version() { 293 | Global debug 294 | OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" 295 | Global ReferenceVersion 296 | md := new MultiMony(debug) 297 | Yunit.assert(md.version == ReferenceVersion) 298 | OutputDebug % A_ThisFunc " <" md.version "> <-> Required <" ReferenceVersion ">" 299 | OutputDebug % ">>>>[" A_ThisFunc "]>>>>" 300 | } 301 | 302 | End() { 303 | } 304 | } -------------------------------------------------------------------------------- /YUnit_Pointy.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv 2 | #SingleInstance force 3 | 4 | #Include %A_ScriptDir%\Yunit\Yunit.ahk 5 | #Include %A_ScriptDir%\Yunit\Window.ahk 6 | #Include %A_ScriptDir%\Yunit\StdOut.ahk 7 | #include 8 | 9 | #Warn All 10 | #Warn LocalSameAsGlobal, Off 11 | 12 | ReferenceVersion := "0.2.0" 13 | 14 | Yunit.Use(YunitStdOut, YunitWindow).Test(CompareTestSuite, MiscTestSuite) 15 | Return 16 | 17 | class MiscTestSuite 18 | { 19 | Begin() 20 | { 21 | debug := 1 22 | this.r := new Pointy(100,100,debug) 23 | } 24 | 25 | Version() 26 | { 27 | Global ReferenceVersion 28 | Yunit.assert(this.r._version == ReferenceVersion) 29 | } 30 | 31 | Constructor() { 32 | Yunit.assert(this.r.x == 100) 33 | Yunit.assert(this.r.y == 100) 34 | } 35 | 36 | 37 | End() 38 | { 39 | this.remove("r") 40 | this.r := 41 | } 42 | 43 | } 44 | 45 | 46 | class CompareTestSuite 47 | { 48 | Begin() 49 | { 50 | debug := 1 51 | this.r := new Pointy(100,100,debug) 52 | } 53 | 54 | 55 | Equal() { 56 | comp := new Pointy(this.r.x, this.r.y, 0) 57 | Yunit.assert(this.r.equal(comp) == true) 58 | return 59 | } 60 | 61 | NonEqual() { 62 | comp := new Pointy(this.r.x + 10, this.r.y, 0) 63 | Yunit.assert(this.r.equal(comp) == false) 64 | return 65 | } 66 | 67 | End() 68 | { 69 | this.remove("r") 70 | this.r := 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /YUnit_Recty.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv 2 | #SingleInstance force 3 | 4 | #Include %A_ScriptDir%\Yunit\Yunit.ahk 5 | #Include %A_ScriptDir%\Yunit\Window.ahk 6 | #Include %A_ScriptDir%\Yunit\StdOut.ahk 7 | #include 8 | 9 | #Warn All 10 | #Warn LocalSameAsGlobal, Off 11 | 12 | ReferenceVersion := "0.3.1" 13 | 14 | Yunit.Use(YunitStdOut, YunitWindow).Test(CompareTestSuite, MiscTestSuite) 15 | Return 16 | 17 | class MiscTestSuite 18 | { 19 | Begin() 20 | { 21 | debug := 1 22 | this.r := new Recty(100,100,100,100,debug) 23 | } 24 | 25 | Version() 26 | { 27 | Global ReferenceVersion 28 | Yunit.assert(this.r._version == ReferenceVersion) 29 | } 30 | 31 | Constructor() { 32 | Yunit.assert(this.r.x == 100) 33 | Yunit.assert(this.r.y == 100) 34 | Yunit.assert(this.r.w == 100) 35 | Yunit.assert(this.r.h == 100) 36 | } 37 | 38 | Getter() { 39 | Yunit.assert(this.r.xul == this.r.x) 40 | Yunit.assert(this.r.yul == this.r.y) 41 | Yunit.assert(this.r.xlr == this.r.x + this.r.w) 42 | Yunit.assert(this.r.ylr == this.r.y + this.r.h) 43 | } 44 | 45 | Setter() { 46 | this.r.xul := 90 47 | this.r.yul := 90 48 | this.r.xlr := 210 49 | this.r.ylr := 210 50 | Yunit.assert(this.r.x == 90) 51 | Yunit.assert(this.r.y == 90) 52 | Yunit.assert(this.r.w == 120) 53 | Yunit.assert(this.r.h == 120) 54 | } 55 | 56 | 57 | End() 58 | { 59 | this.remove("r") 60 | this.r := 61 | } 62 | 63 | } 64 | 65 | 66 | class CompareTestSuite 67 | { 68 | Begin() 69 | { 70 | debug := 1 71 | this.r := new Recty(100,100,100,100,debug) 72 | } 73 | 74 | 75 | Equal() { 76 | comp := new Recty(this.r.x, this.r.y, this.r.w, this.r.h, 0) 77 | Yunit.assert(this.r.equal(comp) == true) 78 | Yunit.assert(this.r.equalPos(comp) == true) 79 | Yunit.assert(this.r.equalSize(comp) == true) 80 | return 81 | } 82 | 83 | NonEqualPos() { 84 | comp := new Recty(this.r.x + 10, this.r.y, this.r.w, this.r.h, 0) 85 | Yunit.assert(this.r.equal(comp) == false) 86 | Yunit.assert(this.r.equalPos(comp) == false) 87 | Yunit.assert(this.r.equalSize(comp) == true) 88 | comp := 89 | comp := new Recty(this.r.x, this.r.y + 10, this.r.w, this.r.h, 0) 90 | Yunit.assert(this.r.equal(comp) == false) 91 | Yunit.assert(this.r.equalPos(comp) == false) 92 | Yunit.assert(this.r.equalSize(comp) == true) 93 | comp := 94 | comp := new Recty(this.r.x + 10, this.r.y + 10, this.r.w, this.r.h, 0) 95 | Yunit.assert(this.r.equal(comp) == false) 96 | Yunit.assert(this.r.equalPos(comp) == false) 97 | Yunit.assert(this.r.equalSize(comp) == true) 98 | return 99 | } 100 | 101 | NonEqualSize() { 102 | comp := new Recty(this.r.x , this.r.y, this.r.w+10, this.r.h, 0) 103 | Yunit.assert(this.r.equal(comp) == false) 104 | Yunit.assert(this.r.equalPos(comp) == true) 105 | Yunit.assert(this.r.equalSize(comp) == false) 106 | comp := 107 | comp := new Recty(this.r.x , this.r.y, this.r.w, this.r.h+10, 0) 108 | Yunit.assert(this.r.equal(comp) == false) 109 | Yunit.assert(this.r.equalPos(comp) == true) 110 | Yunit.assert(this.r.equalSize(comp) == false) 111 | comp := 112 | comp := new Recty(this.r.x , this.r.y, this.r.w+10, this.r.h+10, 0) 113 | Yunit.assert(this.r.equal(comp) == false) 114 | Yunit.assert(this.r.equalPos(comp) == true) 115 | Yunit.assert(this.r.equalSize(comp) == false) 116 | return 117 | } 118 | 119 | NonEqual() { 120 | comp := new Recty(this.r.x+1, this.r.y, this.r.w-1, this.r.h, 0) 121 | Yunit.assert(this.r.equal(comp) == false) 122 | Yunit.assert(this.r.equalPos(comp) == false) 123 | Yunit.assert(this.r.equalSize(comp) == false) 124 | return 125 | } 126 | 127 | End() 128 | { 129 | this.remove("r") 130 | this.r := 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /YUnit_Windy.ahk: -------------------------------------------------------------------------------- 1 | ;#NoEnv 2 | #Warn 3 | 4 | #Include %A_ScriptDir%\Yunit\Yunit.ahk 5 | #Include %A_ScriptDir%\Yunit\Window.ahk 6 | #Include %A_ScriptDir%\Yunit\StdOut.ahk 7 | #include 8 | #include 9 | 10 | ; #Warn All 11 | ;#Warn LocalSameAsGlobal, Off 12 | #SingleInstance force 13 | 14 | ReferenceVersion := "0.10.3" 15 | debug := 1 16 | 17 | OutputDebug DBGVIEWCLEAR 18 | 19 | ;Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, TempTestSuite) 20 | Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, GeometryTestSuite, MiscTestSuite, NotRealWindowTestSuite, HideShowTestSuite, ExistTestSuite, RollupTestSuite, MoveResizeTestSuite, TransparencyTestSuite) 21 | Return 22 | 23 | 24 | ; ################################################################### 25 | class TempTestSuite { 26 | Begin() { 27 | Global debug 28 | this.obj := new Windy(0, debug) 29 | } 30 | 31 | nextprevious() { 32 | Global debug 33 | 34 | dbgOut(">[" A_ThisFunc "]") 35 | hwndNext := this.obj.next 36 | nextObj := new Windy(hwndNext, 0) 37 | OutputDebug % "[IMPORTANT] NEXT OF [" this.obj.hwnd "-<" this.obj.title ">]: [" hwndNext "-<" nextObj.title ">]" 38 | hwndPrev := this.obj.previous 39 | prevObj := new Windy(hwndPrev, 0) 40 | OutputDebug % "[IMPORTANT] PREVIOUS OF [" this.obj.hwnd "-<" this.obj.title ">]: [" hwndPrev "-" prevObj.title "]" 41 | 42 | Yunit.assert(this.obj.hwnd == prevObj.next) 43 | Yunit.assert(this.obj.hwnd == nextObj.previous) 44 | 45 | dbgOut("<[" A_ThisFunc "]") 46 | } 47 | 48 | End() { 49 | this.obj.kill() 50 | this.remove("obj") 51 | this.obj := 52 | } 53 | } 54 | 55 | ; ################################################################### 56 | class _BaseTestSuite { 57 | Begin() { 58 | Global debug 59 | this.obj := new Windy(0, debug) 60 | } 61 | 62 | Version() { 63 | dbgOut(">[" A_ThisFunc "]") 64 | Global ReferenceVersion 65 | Yunit.assert(this.obj._version == ReferenceVersion) 66 | dbgOut("<[" A_ThisFunc "]") 67 | } 68 | 69 | End() { 70 | this.obj.kill() 71 | this.remove("obj") 72 | this.obj := 73 | } 74 | } 75 | 76 | ; ################################################################### 77 | class GeometryTestSuite { 78 | Begin() { 79 | Global debug 80 | this.obj := new Windy(0, debug) 81 | } 82 | 83 | captionheight() { 84 | Global debug 85 | 86 | dbgOut(">[" A_ThisFunc "]") 87 | x := this.obj.captionheight 88 | Yunit.assert(x == 22) 89 | dbgOut("<[" A_ThisFunc "]") 90 | } 91 | 92 | End() { 93 | this.obj.kill() 94 | this.remove("obj") 95 | this.obj := 96 | } 97 | } 98 | 99 | ; ################################################################### 100 | class TileTestSuite { 101 | Begin() { 102 | Global debug 103 | this.obj := new Windy(0, debug) 104 | } 105 | 106 | movePercental() { 107 | Global debug 108 | 109 | dbgOut(">[" A_ThisFunc "]") 110 | this.obj.movePercental(25, 25, 50, 50) 111 | MsgBox % A_ThisFunc " - To be done ..." 112 | dbgOut("<[" A_ThisFunc "]") 113 | } 114 | 115 | End() { 116 | this.obj.kill() 117 | this.remove("obj") 118 | this.obj := 119 | } 120 | } 121 | 122 | ; ################################################################### 123 | class TransparencyTestSuite { 124 | Begin() { 125 | Global debug 126 | this.obj := new Windy(0, debug) 127 | } 128 | 129 | Transparency() { 130 | dbgOut(">[" A_ThisFunc "]") 131 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" 132 | t := this.obj.transparency 133 | Yunit.assert(t == 255) 134 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" 135 | this.obj.transparency(10) := 100 136 | t := this.obj.transparency 137 | Yunit.assert(t == 100) 138 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" 139 | this.obj.transparency(1) := "OFF" 140 | t := this.obj.transparency 141 | Yunit.assert(t == 255) 142 | dbgOut("<[" A_ThisFunc "]") 143 | } 144 | 145 | TransparencyNoCaption() { 146 | dbgOut(">[" A_ThisFunc "]") 147 | this.obj.caption := false 148 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" 149 | t := this.obj.transparency 150 | Yunit.assert(t == 255) 151 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" 152 | this.obj.transparency(10) := 100 153 | t := this.obj.transparency 154 | Yunit.assert(t == 100) 155 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" 156 | this.obj.transparency(1) := "OFF" 157 | t := this.obj.transparency 158 | Yunit.assert(t == 255) 159 | dbgOut("<[" A_ThisFunc "]") 160 | } 161 | 162 | End() { 163 | this.obj.kill() 164 | this.remove("obj") 165 | this.obj := 166 | } 167 | } 168 | 169 | ; ################################################################### 170 | class RollupTestSuite { 171 | Begin() { 172 | Global debug 173 | this.obj := new Windy(0, debug) 174 | } 175 | 176 | RollupToggle() { 177 | Global debug 178 | 179 | dbgOut(">[" A_ThisFunc "]") 180 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" 181 | val := this.obj.rolledUp 182 | Yunit.assert(val == false) 183 | 184 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 2 ****" 185 | this.obj.rolledUp := false 186 | val := this.obj.rolledUp 187 | Yunit.assert(val == false) 188 | 189 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" 190 | this.obj.rolledUp := true 191 | val := this.obj.rolledUp 192 | Yunit.assert(val == true) 193 | 194 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 4 ****" 195 | this.obj.rolledUp := false 196 | val := this.obj.rolledUp 197 | Yunit.assert(val == false) 198 | 199 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 5 ****" 200 | this.obj.rolledUp := !this.obj.rolledUp ; as the window wasn't rolled up, it should be rolled up now 201 | val := this.obj.rolledUp 202 | Yunit.assert(val == true) 203 | 204 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 6 ****" 205 | this.obj.rolledUp := !this.obj.rolledUp ; as the window was rolled up, it shouldn't be rolled up now 206 | val := this.obj.rolledUp 207 | Yunit.assert(val == false) 208 | 209 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 7 ****" 210 | this.End() 211 | val := this.obj.rolledUp 212 | Yunit.assert(val == ) 213 | dbgOut("<[" A_ThisFunc "]") 214 | } 215 | 216 | End() { 217 | this.obj.kill() 218 | this.remove("obj") 219 | this.obj := 220 | } 221 | } 222 | 223 | ; ################################################################### 224 | class MoveResizeTestSuite { 225 | Begin() { 226 | Global debug 227 | this.obj := new Windy(0, debug) 228 | } 229 | 230 | Maximize() { 231 | dbgOut(">[" A_ThisFunc "]") 232 | Yunit.assert(this.obj.maximized == false) 233 | Yunit.assert(this.obj.minimized == false) 234 | this.obj.maximized := true 235 | Yunit.assert(this.obj.maximized == true) 236 | Yunit.assert(this.obj.minimized == false) 237 | this.obj.maximized := false 238 | Yunit.assert(this.obj.maximized == false) 239 | Yunit.assert(this.obj.minimized == false) 240 | this.obj.maximized := !this.obj.maximized 241 | Yunit.assert(this.obj.maximized == true) 242 | Yunit.assert(this.obj.minimized == false) 243 | this.obj.maximized := !this.obj.maximized 244 | Yunit.assert(this.obj.maximized == false) 245 | Yunit.assert(this.obj.minimized == false) 246 | dbgOut("<[" A_ThisFunc "]") 247 | 248 | } 249 | 250 | Minimize() { 251 | dbgOut(">[" A_ThisFunc "]") 252 | Yunit.assert(this.obj.maximized == false) 253 | Yunit.assert(this.obj.minimized == false) 254 | this.obj.minimized := true 255 | Yunit.assert(this.obj.maximized == false) 256 | Yunit.assert(this.obj.minimized == true) 257 | this.obj.minimized := false 258 | Yunit.assert(this.obj.maximized == false) 259 | Yunit.assert(this.obj.minimized == false) 260 | this.obj.minimized := !this.obj.minimized 261 | Yunit.assert(this.obj.maximized == false) 262 | Yunit.assert(this.obj.minimized == true) 263 | this.obj.minimized := !this.obj.minimized 264 | Yunit.assert(this.obj.maximized == false) 265 | Yunit.assert(this.obj.minimized == false) 266 | dbgOut("<[" A_ThisFunc "]") 267 | 268 | } 269 | 270 | MoveViaWinMove() { 271 | dbgOut(">[" A_ThisFunc "]") 272 | oldPos := this.obj.posSize 273 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 274 | 275 | xnew := oldPos.x+200 276 | ynew := oldPos.y+200 277 | 278 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" 279 | WinMove % "ahk_id" this.obj.hwnd, ,xnew, ynew 280 | newPos := this.obj.posSize 281 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 282 | Yunit.assert(newPos.x == xnew) 283 | Yunit.assert(newPos.y == ynew) 284 | Yunit.assert(newPos.w == oldPos.w) 285 | Yunit.assert(newPos.h == oldPos.h) 286 | dbgOut("<[" A_ThisFunc "]") 287 | } 288 | 289 | MoveViaMoveMethod() { 290 | dbgOut(">[" A_ThisFunc "]") 291 | oldPos := this.obj.posSize 292 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 293 | 294 | xnew := oldPos.x+200 295 | ynew := oldPos.y+200 296 | 297 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" 298 | this.obj.move(xnew, ynew, oldPos.w, oldPos.h) 299 | newPos := this.obj.posSize 300 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 301 | Yunit.assert(newPos.x == xnew) 302 | Yunit.assert(newPos.y == ynew) 303 | Yunit.assert(newPos.w == oldPos.w) 304 | Yunit.assert(newPos.h == oldPos.h) 305 | dbgOut("<[" A_ThisFunc "]") 306 | } 307 | 308 | MoveViaPosSizeProperty() { 309 | dbgOut(">[" A_ThisFunc "]") 310 | oldPos := this.obj.posSize 311 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 312 | 313 | xnew := oldPos.x+200 314 | ynew := oldPos.y+200 315 | 316 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" 317 | this.obj.posSize := new Recty(xnew,ynew,oldPos.w,oldPos.h) 318 | newPos := this.obj.posSize 319 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 320 | Yunit.assert(newPos.x == xnew) 321 | Yunit.assert(newPos.y == ynew) 322 | Yunit.assert(newPos.w == oldPos.w) 323 | Yunit.assert(newPos.h == oldPos.h) 324 | dbgOut("<[" A_ThisFunc "]") 325 | } 326 | 327 | MoveViaPosProperty() { 328 | dbgOut(">[" A_ThisFunc "]") 329 | oldPos := this.obj.pos 330 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 331 | 332 | xnew := oldPos.x+200 333 | ynew := oldPos.y+200 334 | 335 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew ")" 336 | this.obj.pos := new Pointy(xnew,ynew) 337 | newPos := this.obj.pos 338 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 339 | Yunit.assert(newPos.x == xnew) 340 | Yunit.assert(newPos.y == ynew) 341 | dbgOut("<[" A_ThisFunc "]") 342 | } 343 | 344 | MoveResizeViaWinMove() { 345 | dbgOut(">[" A_ThisFunc "]") 346 | oldPos := this.obj.posSize 347 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 348 | 349 | xnew := oldPos.x+10 350 | ynew := oldPos.y+20 351 | wnew := oldPos.w+10 352 | hnew := oldPos.h+20 353 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" 354 | WinMove % "ahk_id" this.obj.hwnd, , xnew, ynew, wnew, hnew 355 | newPos := this.obj.posSize 356 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 357 | Yunit.assert(newPos.x == xnew) 358 | Yunit.assert(newPos.y == ynew) 359 | Yunit.assert(newPos.w == wnew) 360 | Yunit.assert(newPos.h == hnew) 361 | 362 | dbgOut("<[" A_ThisFunc "]") 363 | } 364 | 365 | MoveResizeViaMoveMehod() { 366 | dbgOut(">[" A_ThisFunc "]") 367 | oldPos := this.obj.posSize 368 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 369 | 370 | xnew := oldPos.x+10 371 | ynew := oldPos.y+20 372 | wnew := oldPos.w+10 373 | hnew := oldPos.h+20 374 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" 375 | this.obj.move(xnew, ynew, wnew, hnew) 376 | newPos := this.obj.posSize 377 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 378 | Yunit.assert(newPos.x == xnew) 379 | Yunit.assert(newPos.y == ynew) 380 | Yunit.assert(newPos.w == wnew) 381 | Yunit.assert(newPos.h == hnew) 382 | 383 | dbgOut("<[" A_ThisFunc "]") 384 | } 385 | 386 | MoveResizeViaPosSizeProperty() { 387 | dbgOut(">[" A_ThisFunc "]") 388 | oldPos := this.obj.posSize 389 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 390 | 391 | xnew := oldPos.x+10 392 | ynew := oldPos.y+20 393 | wnew := oldPos.w+10 394 | hnew := oldPos.h+20 395 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" 396 | this.obj.posSize := new Recty(xnew, ynew, wnew, hnew) 397 | newPos := this.obj.posSize 398 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 399 | Yunit.assert(newPos.x == xnew) 400 | Yunit.assert(newPos.y == ynew) 401 | Yunit.assert(newPos.w == wnew) 402 | Yunit.assert(newPos.h == hnew) 403 | 404 | dbgOut("<[" A_ThisFunc "]") 405 | } 406 | 407 | ResizeViaWinMove() { 408 | dbgOut(">[" A_ThisFunc "]") 409 | oldPos := this.obj.posSize 410 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 411 | 412 | wnew := oldPos.w+100 413 | hnew := oldPos.h+200 414 | 415 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" 416 | WinMove % "ahk_id" this.obj.hwnd, , oldPos.x, oldPos.y, wnew, hnew 417 | newPos := this.obj.posSize 418 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 419 | Yunit.assert(newPos.x == oldPos.x) 420 | Yunit.assert(newPos.y == oldPos.y) 421 | Yunit.assert(newPos.w == wnew) 422 | Yunit.assert(newPos.h == hnew) 423 | 424 | dbgOut("<[" A_ThisFunc "]") 425 | } 426 | 427 | ResizeViaMoveMethod() { 428 | dbgOut(">[" A_ThisFunc "]") 429 | oldPos := this.obj.posSize 430 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 431 | 432 | wnew := oldPos.w+100 433 | hnew := oldPos.h+200 434 | 435 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" 436 | this.obj.move(oldPos.x, oldPos.y, wnew, hnew) 437 | newPos := this.obj.posSize 438 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 439 | Yunit.assert(newPos.x == oldPos.x) 440 | Yunit.assert(newPos.y == oldPos.y) 441 | Yunit.assert(newPos.w == wnew) 442 | Yunit.assert(newPos.h == hnew) 443 | 444 | dbgOut("<[" A_ThisFunc "]") 445 | } 446 | 447 | ResizeViaPosSizeProperty() { 448 | dbgOut(">[" A_ThisFunc "]") 449 | oldPos := this.obj.posSize 450 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 451 | 452 | wnew := oldPos.w+100 453 | hnew := oldPos.h+200 454 | 455 | OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" 456 | this.obj.posSize := new Recty(oldPos.x, oldPos.y, wnew, hnew) 457 | newPos := this.obj.posSize 458 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 459 | Yunit.assert(newPos.x == oldPos.x) 460 | Yunit.assert(newPos.y == oldPos.y) 461 | Yunit.assert(newPos.w == wnew) 462 | Yunit.assert(newPos.h == hnew) 463 | dbgOut("<[" A_ThisFunc "]") 464 | } 465 | 466 | ResizeViaSizeProperty() { 467 | dbgOut(">[" A_ThisFunc "]") 468 | oldSize:= this.obj.size 469 | OutputDebug % "[IMPORTANT]Initial Size: " oldSize.Dump() 470 | 471 | wnew := oldSize.x+100 472 | hnew := oldSize.y+200 473 | 474 | OutputDebug % "[IMPORTANT]BEFORE - Resizing from " oldSize.Dump() " to (" wnew "," hnew ")" 475 | this.obj.size := new Pointy(wnew, hnew) 476 | newSize := this.obj.size 477 | OutputDebug % "[IMPORTANT]AFTER - Resizing from " oldSize.Dump() " to " newSize.Dump() 478 | Yunit.assert(newSize.x == wnew) 479 | Yunit.assert(newSize.y == hnew) 480 | dbgOut("<[" A_ThisFunc "]") 481 | } 482 | 483 | NoMoveResizeViaWinMove() { 484 | dbgOut(">[" A_ThisFunc "]") 485 | oldPos := this.obj.posSize 486 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 487 | WinMove % "ahk_id" this.obj.hwnd, , oldPos.x, oldPos.y, oldPos.w, oldPos.h 488 | newPos := this.obj.posSize 489 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 490 | Yunit.assert(newPos.x == oldPos.x) 491 | Yunit.assert(newPos.y == oldPos.y) 492 | Yunit.assert(newPos.w == oldPos.w) 493 | Yunit.assert(newPos.h == oldPos.h) 494 | dbgOut("<[" A_ThisFunc "]") 495 | } 496 | 497 | NoMoveResizeViaMoveMehod() { 498 | dbgOut(">[" A_ThisFunc "]") 499 | oldPos := this.obj.posSize 500 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 501 | this.obj.move(oldPos.x, oldPos.y, oldPos.w, oldPos.h) 502 | newPos := this.obj.posSize 503 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 504 | Yunit.assert(newPos.x == oldPos.x) 505 | Yunit.assert(newPos.y == oldPos.y) 506 | Yunit.assert(newPos.w == oldPos.w) 507 | Yunit.assert(newPos.h == oldPos.h) 508 | dbgOut("<[" A_ThisFunc "]") 509 | } 510 | 511 | NoMoveResizeViaPosSizeProperty() { 512 | dbgOut(">[" A_ThisFunc "]") 513 | oldPos := this.obj.posSize 514 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 515 | this.obj.posSize := new Recty(oldPos.x, oldPos.y, oldPos.w, oldPos.h) 516 | newPos := this.obj.posSize 517 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 518 | Yunit.assert(newPos.x == oldPos.x) 519 | Yunit.assert(newPos.y == oldPos.y) 520 | Yunit.assert(newPos.w == oldPos.w) 521 | Yunit.assert(newPos.h == oldPos.h) 522 | dbgOut("<[" A_ThisFunc "]") 523 | } 524 | 525 | NoMoveViaPosProperty() { 526 | dbgOut(">[" A_ThisFunc "]") 527 | oldPos := this.obj.pos 528 | OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() 529 | this.obj.pos := new Pointy(oldPos.x, oldPos.y) 530 | newPos := this.obj.pos 531 | OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() 532 | Yunit.assert(newPos.x == oldPos.x) 533 | Yunit.assert(newPos.y == oldPos.y) 534 | dbgOut("<[" A_ThisFunc "]") 535 | } 536 | 537 | NoResizeViaSizeProperty() { 538 | dbgOut(">[" A_ThisFunc "]") 539 | oldSize := this.obj.size 540 | OutputDebug % "[IMPORTANT]Initial Size: " oldSize.Dump() 541 | this.obj.size := new Pointy(oldSize.x, oldSize.y) 542 | newSize := this.obj.size 543 | OutputDebug % "[IMPORTANT]AFTER - Resizing from " oldSize.Dump() " to " newSize.Dump() 544 | Yunit.assert(newSize.x == oldSize.x) 545 | Yunit.assert(newSize.y == oldSize.y) 546 | dbgOut("<[" A_ThisFunc "]") 547 | } 548 | 549 | scale() { 550 | dbgOut(">[" A_ThisFunc "]") 551 | this.obj.maximized := true 552 | this.obj.scale(2) 553 | dbgOut("<[" A_ThisFunc "]") 554 | } 555 | 556 | End() { 557 | this.obj.kill() 558 | this.remove("obj") 559 | this.obj := 560 | } 561 | } 562 | 563 | ; ################################################################### 564 | class HideShowTestSuite { 565 | Begin() { 566 | Global debug 567 | this.obj := new Windy(0, debug) 568 | } 569 | 570 | HideShowToggle() { 571 | dbgOut(">[" A_ThisFunc "]") 572 | Yunit.assert(this.obj.hidden == false) 573 | this.obj.hidden := false 574 | Yunit.assert(this.obj.hidden == false) 575 | this.obj.hidden := true 576 | Yunit.assert(this.obj.hidden == true) 577 | this.obj.hidden := false 578 | Yunit.assert(this.obj.hidden == false) 579 | this.obj.hidden := true 580 | Yunit.assert(this.obj.hidden == true) 581 | this.obj.hidden := !this.obj.hidden ; as the window was hidden, it shouldn't be hidden now 582 | Yunit.assert(this.obj.hidden == false) 583 | this.obj.hidden := !this.obj.hidden ; as the window wasn't hidden, it should be hidden now 584 | Yunit.assert(this.obj.hidden == true) 585 | dbgOut("<[" A_ThisFunc "]") 586 | } 587 | 588 | HiddenFalse() { 589 | dbgOut(">[" A_ThisFunc "]") 590 | Yunit.assert(this.obj.hidden==false) 591 | dbgOut("<[" A_ThisFunc "]") 592 | } 593 | 594 | HiddenTrue() { 595 | dbgOut(">[" A_ThisFunc "]") 596 | this.obj.hidden := true 597 | Yunit.assert(this.obj.hidden == true) 598 | dbgOut("<[" A_ThisFunc "]") 599 | } 600 | 601 | HiddenDoesNotExist() { 602 | dbgOut(">[" A_ThisFunc "]") 603 | this.obj.kill() 604 | Yunit.assert(this.obj.hidden==-1) 605 | dbgOut("<[" A_ThisFunc "]") 606 | } 607 | 608 | End() { 609 | this.obj.kill() 610 | this.remove("obj") 611 | this.obj := 612 | } 613 | } 614 | 615 | ; ################################################################### 616 | class NotRealWindowTestSuite { 617 | Test() { 618 | dbgOut(">[" A_ThisFunc "]") 619 | Global debug 620 | HDesktop := DllCall("User32.dll\GetDesktopWindow", "UPtr") 621 | this.obj := new Windy(HDesktop, debug) 622 | Yunit.assert(this.obj==) 623 | dbgOut("<[" A_ThisFunc "]") 624 | } 625 | } 626 | 627 | ; ################################################################### 628 | class MiscTestSuite { 629 | Begin() { 630 | Global debug 631 | ; Create a Testwindow ... 632 | Run, notepad.exe 633 | WinWait, ahk_class Notepad, , 2 634 | WinMove, ahk_class Notepad,, 10, 10, 300, 300 635 | _hWnd := WinExist("ahk_class Notepad") 636 | this.obj := new Windy(_hWnd, debug) 637 | } 638 | 639 | activated() { 640 | Global debug 641 | 642 | dbgOut(">[" A_ThisFunc "]") 643 | this.obj.activated := true 644 | sleep 1000 645 | val := (this.obj.activated == true) 646 | Yunit.assert(val == true) 647 | this.obj.activated := false 648 | Yunit.assert(this.obj.activated == false) 649 | this.obj.activated := true 650 | newObj := new Windy(0, debug) 651 | Yunit.assert(this.obj.activated == false) 652 | dbgOut("<[" A_ThisFunc "]") 653 | } 654 | 655 | Caption() { 656 | dbgOut(">[" A_ThisFunc "]") 657 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" 658 | Yunit.assert(this.obj.caption == 1) 659 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" 660 | this.obj.caption := 0 661 | Yunit.assert(this.obj.caption == 0) 662 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" 663 | this.obj.caption := 1 664 | Yunit.assert(this.obj.caption == 1) 665 | dbgOut("<[" A_ThisFunc "]") 666 | } 667 | 668 | Center() { 669 | Global debug 670 | 671 | dbgOut(">[" A_ThisFunc "]") 672 | hwnd := this.obj.hwnd 673 | WinGetPos x, y, w, h, ahk_id %hwnd% 674 | centerx := round(x+(w)/2) 675 | centery := round(y+(h)/2) 676 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" 677 | center := this.obj.centercoords 678 | Yunit.assert(center.x == centerx) 679 | Yunit.assert(center.y == centery) 680 | 681 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 2 ****" 682 | newCenter := new Pointy(205,205,debug) 683 | this.obj.centercoords := newCenter 684 | center := this.obj.centercoords 685 | Yunit.assert(center.x == 205) 686 | Yunit.assert(center.y == 205) 687 | dbgOut("<[" A_ThisFunc "]") 688 | } 689 | 690 | Classname() { 691 | dbgOut(">[" A_ThisFunc "]") 692 | Yunit.assert(this.obj.classname =="Notepad") 693 | dbgOut("<[" A_ThisFunc "]") 694 | } 695 | 696 | hscrollable() { 697 | dbgOut(">[" A_ThisFunc "]") 698 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > Initial" 699 | Yunit.assert(this.obj.hscrollable == 0) 700 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" 701 | this.obj.hscrollable := 1 702 | Yunit.assert(this.obj.hscrollable == 1) 703 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" 704 | this.obj.hscrollable := 0 705 | Yunit.assert(this.obj.hscrollable == 0) 706 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" 707 | this.obj.hscrollable := !this.obj.hscrollable 708 | Yunit.assert(this.obj.hscrollable == 1) 709 | dbgOut("<[" A_ThisFunc "]") 710 | } 711 | 712 | maximizebox() { 713 | dbgOut(">[" A_ThisFunc "]") 714 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > Initial" 715 | Yunit.assert(this.obj.maximizebox == 1) 716 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" 717 | this.obj.maximizebox := 0 718 | Yunit.assert(this.obj.maximizebox == 0) 719 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" 720 | this.obj.maximizebox := !this.obj.maximizebox 721 | Yunit.assert(this.obj.caption == 1) 722 | dbgOut("<[" A_ThisFunc "]") 723 | } 724 | 725 | minimizebox() { 726 | dbgOut(">[" A_ThisFunc "]") 727 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > Initial" 728 | Yunit.assert(this.obj.minimizebox == 1) 729 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" 730 | this.obj.minimizebox := 0 731 | Yunit.assert(this.obj.minimizebox == 0) 732 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" 733 | this.obj.minimizebox := !this.obj.minimizebox 734 | Yunit.assert(this.obj.caption == 1) 735 | dbgOut("<[" A_ThisFunc "]") 736 | 737 | } 738 | 739 | nextprevious() { 740 | Global debug 741 | 742 | dbgOut(">[" A_ThisFunc "]") 743 | hwndNext := this.obj.next 744 | nextObj := new Windy(hwndNext, 0) 745 | OutputDebug % "[IMPORTANT] NEXT OF [" this.obj.hwnd "-<" this.obj.title ">]: [" hwndNext "-<" nextObj.title ">]" 746 | hwndPrev := this.obj.previous 747 | prevObj := new Windy(hwndPrev, 0) 748 | OutputDebug % "[IMPORTANT] PREVIOUS OF [" this.obj.hwnd "-<" this.obj.title ">]: [" hwndPrev "-" prevObj.title "]" 749 | 750 | Yunit.assert(this.obj.hwnd == prevObj.next) 751 | Yunit.assert(this.obj.hwnd == nextObj.previous) 752 | 753 | dbgOut("<[" A_ThisFunc "]") 754 | } 755 | 756 | Title() { 757 | dbgOut(">[" A_ThisFunc "]") 758 | Yunit.assert(this.obj.title =="Unbenannt - Editor") 759 | this.obj.title := "Halllloo" 760 | Yunit.assert(this.obj.title =="Halllloo") 761 | dbgOut("<[" A_ThisFunc "]") 762 | } 763 | 764 | Parent() { 765 | dbgOut(">[" A_ThisFunc "]") 766 | parent := this.parent 767 | Yunit.assert(parent == ) 768 | dbgOut("<[" A_ThisFunc "]") 769 | } 770 | 771 | Processname() { 772 | dbgOut(">[" A_ThisFunc "]") 773 | val := this.obj.processname 774 | Yunit.assert( val == "notepad.exe") 775 | dbgOut("<[" A_ThisFunc "]") 776 | } 777 | 778 | ProcessID() { 779 | dbgOut(">[" A_ThisFunc "]") 780 | val := this.obj.processID 781 | Yunit.assert( val > 0) 782 | dbgOut("<[" A_ThisFunc "]") 783 | } 784 | 785 | Resizable() { 786 | dbgOut(">[" A_ThisFunc "]") 787 | OutputDebug % "[IMPORTANT]...[" A_ThisFunc "]> 1" 788 | Yunit.assert( this.obj.resizable == 1) 789 | OutputDebug % "[IMPORTANT]...[" A_ThisFunc "]> 0" 790 | this.obj.resizable := 0 791 | Yunit.assert( this.obj.resizable == 0) 792 | OutputDebug % "[IMPORTANT]...[" A_ThisFunc "]> toggle" 793 | this.obj.resizable := !this.obj.resizable 794 | Yunit.assert( this.obj.resizable == 1) 795 | dbgOut("<[" A_ThisFunc "]") 796 | sleep, 500 797 | } 798 | 799 | vscrollable() { 800 | dbgOut(">[" A_ThisFunc "]") 801 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > Initial" 802 | Yunit.assert(this.obj.vscrollable == 0) 803 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" 804 | this.obj.vscrollable := 1 805 | Yunit.assert(this.obj.vscrollable == 1) 806 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" 807 | this.obj.vscrollable := 0 808 | Yunit.assert(this.obj.vscrollable == 0) 809 | OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" 810 | this.obj.vscrollable := !this.obj.vscrollable 811 | Yunit.assert(this.obj.vscrollable == 1) 812 | dbgOut("<[" A_ThisFunc "]") 813 | } 814 | 815 | AlwaysOnTop() { 816 | dbgOut(">[" A_ThisFunc "]") 817 | Yunit.assert(this.obj.alwaysontop == false) 818 | this.obj.alwaysOnTop := true 819 | Yunit.assert(this.obj.alwaysontop == true) 820 | this.obj.alwaysOnTop := false 821 | Yunit.assert(this.obj.alwaysontop == false) 822 | this.obj.alwaysOnTop := false 823 | Yunit.assert(this.obj.alwaysontop == false) 824 | this.obj.alwaysOnTop := !this.obj.alwaysOnTop 825 | Yunit.assert(this.obj.alwaysontop == true) 826 | this.obj.alwaysOnTop := !this.obj.alwaysOnTop 827 | Yunit.assert(this.obj.alwaysontop == false) 828 | dbgOut("<[" A_ThisFunc "]") 829 | } 830 | 831 | MonitorID() { 832 | Global debug 833 | dbgOut(">[" A_ThisFunc "]") 834 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" 835 | this.obj.Move(2,2,300,300) 836 | monID := this.obj.monitorID 837 | Yunit.assert(monId == 2) 838 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 2 - via Move ****" 839 | obj := new Mony(2, debug) 840 | rect2 := obj.boundary 841 | this.obj.Move(rect2.x+10,rect2.y+10,300,300) 842 | monID := this.obj.monitorID 843 | Yunit.assert(monId == 2) 844 | OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 - via MonitorID ****" 845 | this.obj.monitorID := 2 846 | monID := this.obj.monitorID 847 | Yunit.assert(monId == 2) 848 | dbgOut("<[" A_ThisFunc "]") 849 | } 850 | 851 | Hangs() { 852 | dbgOut(">[" A_ThisFunc "]") 853 | val := this.obj.hangs 854 | Yunit.assert(val == false) 855 | dbgOut("<[" A_ThisFunc "]") 856 | 857 | } 858 | 859 | Getter() { 860 | dbgOut(">[" A_ThisFunc "]") 861 | hwnd := this.obj.hwnd 862 | WinGetPos x, y, w, h, ahk_id %hwnd% 863 | Yunit.assert(1 == ((this.obj.posSize.x == x) && (this.obj.posSize.y == y) && (this.obj.posSize.w == w) && (this.obj.posSize.h == h))) 864 | dbgOut("<[" A_ThisFunc "]") 865 | } 866 | 867 | owner() { 868 | dbgOut(">[" A_ThisFunc "]") 869 | own:= this.obj.owner 870 | Yunit.assert(own == 0) 871 | dbgOut("<[" A_ThisFunc "]") 872 | } 873 | 874 | End() { 875 | this.obj.kill() 876 | this.remove("obj") 877 | this.obj := 878 | } 879 | 880 | } 881 | 882 | ; ################################################################### 883 | class ExistTestSuite { 884 | Begin() { 885 | Global debug 886 | this.obj := new Windy(0, debug) 887 | } 888 | 889 | ExistNonExistingWindow() { 890 | this.obj.kill() 891 | Yunit.assert(this.obj.exist == false) 892 | } 893 | 894 | ExistExistingWindow() { 895 | dbgOut(">[" A_ThisFunc "]") 896 | Yunit.assert(this.obj.exist ==true) 897 | dbgOut("<[" A_ThisFunc "]") 898 | } 899 | 900 | End() { 901 | this.obj.kill() 902 | this.remove("obj") 903 | this.obj := 904 | } 905 | } 906 | -------------------------------------------------------------------------------- /_build/MakeDist.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoppfrosch/AHK_Windy/50463b7677a49bde35be6f169002f38411d0ad0e/_build/MakeDist.ahk -------------------------------------------------------------------------------- /_build/_inc/BuildTools.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoppfrosch/AHK_Windy/50463b7677a49bde35be6f169002f38411d0ad0e/_build/_inc/BuildTools.ahk -------------------------------------------------------------------------------- /_build/gitlog2md.pl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoppfrosch/AHK_Windy/50463b7677a49bde35be6f169002f38411d0ad0e/_build/gitlog2md.pl -------------------------------------------------------------------------------- /_build/mkDoc.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo Creating documentation.... 4 | echo. 5 | 6 | SET WORK=MKDOC_TEMP 7 | mkdir %WORK% 8 | REM copy ..\lib\Windy\Mony.ahk %WORK% 9 | copy ..\lib\Windy.ahk %WORK%\Windy_Main.ahk 10 | copy ..\lib\Windy\Mony.ahk %WORK% 11 | copy ..\lib\Windy\MultiMony.ahk %WORK% 12 | copy ..\lib\Windy\Recty.ahk %WORK% 13 | copy ..\lib\Windy\Pointy.ahk %WORK% 14 | copy ..\lib\Windy\Mousy.ahk %WORK% 15 | copy ..\lib\Windy\Windy.ahk %WORK% 16 | copy ..\lib\Windy\WindLy.ahk %WORK% 17 | 18 | ::path to the natural doc folder 19 | SET NDPATH=d:\Usr\programme\NaturalDocs\ 20 | 21 | pushd %WORK% 22 | 23 | ::project root path 24 | SET ROOT=%CD% 25 | 26 | ::documentation folder 27 | SET DOC=_doc 28 | 29 | mkdir "%ROOT%\%DOC%\_ndProj" 2>nul 30 | pushd "%NDPATH%" 31 | if exist "%ROOT%\images" SET IMG=-img "%ROOT%\images" 32 | 33 | call NaturalDocs.exe -i "%ROOT%" -o HTML "%ROOT%\%DOC%" -p "%ROOT%\%DOC%\_ndProj" %IMG% 34 | 35 | popd 36 | 37 | if "%1" == "s" ( 38 | echo Merging html files ... 39 | mkdocs 40 | rmdir /Q /S _doc 41 | echo Done. 42 | echo. 43 | ) 44 | 45 | popd 46 | 47 | .. Publish documentation to gh-page branch ... 48 | pushd ..\..\AHK_Windy_gh-pages 49 | xcopy /E /Y %ROOT%\%DOC% . 50 | popd 51 | rmdir /S /Q %WORK% 52 | -------------------------------------------------------------------------------- /lib/DbgOut.ahk: -------------------------------------------------------------------------------- 1 | /* 2 | Name: dbgOut - Prints given String via OutputDebug and indents string according to a given prefix 3 | Version 0.1 (20161130) 4 | Created: 20161130 5 | Author: hoppfrosch 6 | Description: 7 | Prints the given Debug-String via command OutputDebug. 8 | The string is indented according to a given prefix in the Debug-String. 9 | This allows a better tracing of stack depth with deep function calls. 10 | 11 | Supported prefixes are currently: 12 | * ">" - This should be used when a funtion is entered. On each usage of this Prefix the indentation level is increased 13 | Example: dbgOut(">[" A_ThisFunc "()]") 14 | * "<" - This should be used when a funtion is exited. On each usage of this Prefix the indentation level is decreased 15 | Example: dbgOut("<[" A_ThisFunc "()]") 16 | * "|" - This should be used for temporary indentation 17 | */ 18 | dbgOut(str, debug := 1) { 19 | static indentLvl := 0 20 | x1 := SubStr(str, 1, 1) 21 | if (x1 = "<") { 22 | indentLvl := indentLvl - 1 23 | } 24 | ;if (x1 = "|") { 25 | ; indentLvl := indentLvl + 1 26 | ;} 27 | 28 | if (debug) { 29 | i := 0 30 | indent := "" 31 | while (i < indentLvl) { 32 | indent := indent "++" 33 | i := i + 1 34 | } 35 | OutputDebug % indent str 36 | } 37 | if (x1 = ">") { 38 | indentLvl := indentLvl + 1 39 | } 40 | ;if (x1 = "|") { 41 | ; indentLvl := indentLvl - 1 42 | ;} 43 | } 44 | -------------------------------------------------------------------------------- /lib/SerDes.ahk: -------------------------------------------------------------------------------- 1 | /* Function: SerDes 2 | * Serialize an AHK object to string and optionally dumps it into a file. 3 | * De-serialize a 'SerDes()' formatted string to an AHK object. 4 | * AHK Version: Requires v1.1+ OR v2.0-a049+ 5 | * License: WTFPL (http://www.wtfpl.net/) 6 | * 7 | * Syntax (Serialize): 8 | * str := SerDes( obj [ ,, indent ] ) 9 | * bytes := SerDes( obj, outfile [ , indent ] ) 10 | * Parameter(s): 11 | * str [retval] - String representation of the object. 12 | * bytes [retval] - Bytes written to 'outfile'. 13 | * obj [in] - AHK object to serialize. 14 | * outfile [in, opt] - The file to write to. If no absolute path is 15 | * specified, %A_WorkingDir% is used. 16 | * indent [in, opt] - If indent is an integer or string, then array 17 | * elements and object members will be pretty-printed 18 | * with that indent level. Blank(""), the default, OR 19 | * 0, selects the most compact representation. Using 20 | * an integer indent indents that many spaces per level. 21 | * If indent is a string, (such as "`t"), that string 22 | * is used to indent each level. Negative integer is 23 | * treated as positive. 24 | * 25 | * Syntax (Deserialize): 26 | * obj := SerDes( src ) 27 | * Parameter(s): 28 | * obj [retval] - An AHK object. 29 | * src [in] - Either a 'SerDes()' formatted string or the path 30 | * to the file containing 'SerDes()' formatted text. 31 | * If no absolute path is specified, %A_WorkingDir% 32 | * is used. 33 | * Remarks: 34 | * Serialized output is similar to JSON except for escape sequences which 35 | * follows AHK's specification. Also, strings, numbers and objects are 36 | * allowed as 'object/{}' keys unlike JSON which restricts it to string 37 | * data type only. 38 | * Object references, including circular ones, are supported and notated 39 | * as '$n', where 'n' is the 1-based index of the referenced object in the 40 | * heirarchy tree when encountered during enumeration (for-loop) OR as it 41 | * appears from left to right (for string representation) as marked by an 42 | * opening brace or bracket. See diagram below: 43 | * 1 2 44 | * {"a":["string"], "b":$2} -> '$2' references the object stored in 'a' 45 | * 46 | * Source 47 | * https://github.com/cocobelgica/AutoHotkey-SerDes 48 | */ 49 | SerDes(src, out:="", indent:="") { 50 | if IsObject(src) { 51 | ret := _SerDes(src, indent) 52 | if (out == "") 53 | return ret 54 | if !(f := FileOpen(out, "w")) 55 | throw "Failed to open file: '" out "' for writing." 56 | bytes := f.Write(ret), f.Close() 57 | return bytes ;// return bytes written when dumping to file 58 | } 59 | if FileExist(src) { 60 | if !(f := FileOpen(src, "r")) 61 | throw "Failed to open file: '" src "' for reading." 62 | src := f.Read(), f.Close() 63 | } 64 | ;// Begin de-serialization routine 65 | static is_v2 := (A_AhkVersion >= "2"), q := Chr(34) ;// Double quote 66 | , push := Func(is_v2 ? "ObjPush" : "ObjInsert") 67 | , ins := Func(is_v2 ? "ObjInsertAt" : "ObjInsert") 68 | , set := Func(is_v2 ? "ObjRawSet" : "ObjInsert") 69 | , pop := Func(is_v2 ? "ObjPop" : "ObjRemove") 70 | , del := Func(is_v2 ? "ObjRemoveAt" : "ObjRemove") 71 | static esc_seq := { ;// AHK escape sequences 72 | (Join Q C 73 | "``": "``", ;// accent 74 | (q): q, ;// double quote 75 | "n": "`n", ;// newline 76 | "r": "`r", ;// carriage return 77 | "b": "`b", ;// backspace 78 | "t": "`t", ;// tab 79 | "v": "`v", ;// vertical tab 80 | "a": "`a", ;// alert (bell) 81 | "f": "`f" ;// formfeed 82 | )} 83 | ;// Extract string literals 84 | strings := [], i := 0, end := 0-is_v2 ;// v1.1=0, v2.0-a=-1 -> SubStr() 85 | while (i := InStr(src, q,, i+1)) { 86 | j := i 87 | while (j := InStr(src, q,, j+1)) 88 | if (SubStr(str := SubStr(src, i+1, j-i-1), end) != "``") 89 | break 90 | if !j 91 | throw "Missing close quote(s)." 92 | src := SubStr(src, 1, i) . SubStr(src, j+1) 93 | k := 0 94 | while (k := InStr(str, "``",, k+1)) { 95 | if InStr(q "``nrbtvaf", ch := SubStr(str, k+1, 1)) 96 | str := SubStr(str, 1, k-1) . esc_seq[ch] . SubStr(str, k+2) 97 | else throw "Invalid escape sequence: '``" . ch . "'" 98 | } 99 | %push%(strings, str) ;// strings.Insert(str) / strings.Push(str) 100 | } 101 | ;// Begin recursive descent to parse markup 102 | pos := 0 103 | , is_key := false ;// if true, active data is to be used as associative array key 104 | , refs := [], kobj := [] ;// refs=object references, kobj=objects as keys 105 | , stack := [tree := []] 106 | , is_arr := Object(tree, 1) 107 | , next := q "{[01234567890-" ;// chars considered valid when encountered 108 | while ((ch := SubStr(src, ++pos, 1)) != "") { 109 | if InStr(" `t`n`r", ch) 110 | continue 111 | if !InStr(next, ch) ;// validate current char 112 | throw "Unexpected char: '" ch "'" 113 | is_array := is_arr[_obj := stack[1]] ;// active container object 114 | ;// Associative/Linear array opening 115 | if InStr("{[", ch) { 116 | val := {}, is_arr[val] := ch == "[", %push%(refs, &val) 117 | if is_key 118 | %ins%(kobj, 1, val), key := val 119 | is_array? %push%(_obj, val) : %set%(_obj, key, is_key ? 0 : val) 120 | , %ins%(stack, 1, val), is_key := ch == "{" 121 | , next := q "{[0123456789-$" (is_key ? "}" : "]") ;// Chr(NumGet(ch, "Char")+2) 122 | } 123 | ;// Associative/Linear array closing 124 | else if InStr("}]", ch) { 125 | next := is_arr[stack[2]] ? "]," : "}," 126 | if (kobj[1] == %del%(stack, 1)) 127 | key := %del%(kobj, 1), next := ":" 128 | } 129 | ;// Token 130 | else if InStr(",:", ch) { 131 | if (_obj == tree) 132 | throw "Unexpected char: '" ch "' -> there is no container object." 133 | next := q "{[0123456789-$", is_key := (!is_array && ch == ",") 134 | } 135 | ;// String | Number | Object reference 136 | else { 137 | if (ch == q) { ;// string 138 | val := %del%(strings, 1) 139 | } else { ;// number / object reference 140 | if (is_ref := (ch == "$")) ;// object reference token 141 | pos += 1 142 | val := SubStr(src, pos, (SubStr(src, pos) ~= "[\]\}:,\s]|$")-1) 143 | if (Abs(val) == "") 144 | throw "Invalid number: " val 145 | pos += StrLen(val)-1, val += 0 146 | if is_ref { 147 | if !ObjHasKey(refs, val) 148 | throw "Invalid object reference: $" val 149 | val := Object(refs[val]), is_ref := false 150 | } 151 | } 152 | if is_key 153 | key := val, next := ":" 154 | else 155 | is_array? %push%(_obj, val) : %set%(_obj, key, val) 156 | , next := is_array ? "]," : "}," 157 | } 158 | } 159 | return tree[1] 160 | } 161 | ;// Helper function, serialize object to string -> internal use only 162 | _SerDes(obj, indent:="", lvl:=1, refs:=false) { ;// lvl,refs=internal parameters 163 | static q := Chr(34) ;// Double quote, for v1.1 & v2.0-a compatibility 164 | 165 | if IsObject(obj) { 166 | /* In v2, an exception is thrown when using ObjGetCapacity() on a 167 | * non-standard AHK object (e.g. COM, Func, RegExMatch, File) 168 | */ 169 | if (ObjGetCapacity(obj) == "") 170 | throw "SerDes(): Only standard AHK objects are supported." ; v1.1 171 | if !refs 172 | refs := {} 173 | if ObjHasKey(refs, obj) ;// Object references, includes circular 174 | return "$" refs[obj] ;// return notation = $(index_of_object) 175 | refs[obj] := NumGet(&refs + 4*A_PtrSize)+1 176 | 177 | for k in obj 178 | is_array := k == A_Index 179 | until !is_array 180 | 181 | if (Abs(indent) != "") { 182 | spaces := Abs(indent), indent := "" 183 | Loop % spaces 184 | indent .= " " 185 | } 186 | indt := "" 187 | Loop % indent ? lvl : 0 188 | indt .= indent 189 | 190 | lvl += 1, out := "" ;// , len := NumGet(&obj+4*A_PtrSize) -> unreliable 191 | for k, v in obj { 192 | if !is_array 193 | out .= _SerDes(k,,, refs) . ( indent ? ": " : ":" ) ;// object(s) used as keys are not indented 194 | out .= _SerDes(v, indent, lvl, refs) . ( indent ? ",`n" . indt : "," ) 195 | } 196 | if (out != "") { 197 | out := Trim(out, ",`n" . indent) 198 | if (indent != "") 199 | out := "`n" . indt . out . "`n" . SubStr(indt, 1, -StrLen(indent)) ;// trim 1 level of indentation 200 | } 201 | return is_array ? "[" out "]" : "{" out "}" 202 | } 203 | 204 | else if (ObjGetCapacity([obj], 1) == "") 205 | return obj 206 | 207 | static esc_seq := { ;// AHK escape sequences 208 | (Join Q C 209 | (q): "``" . q, ;// double quote 210 | "`n": "``n", ;// newline 211 | "`r": "``r", ;// carriage return 212 | "`b": "``b", ;// backspace 213 | "`t": "``t", ;// tab 214 | "`v": "``v", ;// vertical tab 215 | "`a": "``a", ;// alert (bell) 216 | "`f": "``f" ;// formfeed 217 | )} 218 | i := -1 219 | while (i := InStr(obj, "``",, i+2)) 220 | obj := SubStr(obj, 1, i-1) . "````" . SubStr(obj, i+1) 221 | for k, v in esc_seq { 222 | /* StringReplace/StrReplace workaround routine for v1.1 and v2.0-a 223 | * compatibility. TODO: Compare w/ RegExReplace(), use RegExReplace()?? 224 | */ 225 | i := -1 226 | while (i := InStr(obj, k,, i+2)) 227 | obj := SubStr(obj, 1, i-1) . v . SubStr(obj, i+1) 228 | } 229 | return q . obj . q 230 | } -------------------------------------------------------------------------------- /lib/Windy.ahk: -------------------------------------------------------------------------------- 1 | /* 2 | Title: Windy, v0.15.4 3 | 4 | Windy provides a collection of classes, which allow a class based approach of handling windows, monitors, etc. 5 | 6 | Following classes exist: 7 | * - Single Monitor 8 | * - Mouse 9 | * - Multi Monitor Environments 10 | * - Points (geometric 2D-points) - this is mostly a helper class being used within this package, but maybe helpful anyway ... 11 | * - Rectangles (consisting of two ) - - this is mostly a helper class being used within this package, but maybe helpful anyway ... 12 | * - Windows 13 | * - Collection (List) of Windows 14 | 15 | Authors: 16 | : Original 17 | 18 | About: License 19 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details. 20 | 21 | */ 22 | #include %A_LineFile%\..\Windy 23 | #include _WindowHandlerEvent.ahk 24 | #include Const_WinUser.ahk 25 | #include Mony.ahk 26 | #include Mousy.ahk 27 | #include MultiMony.ahk 28 | #include Pointy.ahk 29 | #include Recty.ahk 30 | #include WindLy.ahk 31 | #include Windy.ahk 32 | 33 | 34 | Version := "0.15.4" -------------------------------------------------------------------------------- /lib/Windy/Const_WinUser.ahk: -------------------------------------------------------------------------------- 1 | ; ====================================================================================================================== 2 | ; Function: Several Constants from Windows_API (winuser.h) 3 | ; AHK version: 1.1.05+ 4 | ; Language: English 5 | ; Version: 1.0.01.00/2016-02-08/hoppfrosch 6 | 7 | 8 | ; GetWindow() constants ====================== (winuser.h) ============================================================= 9 | class GW { 10 | ; hhttps://msdn.microsoft.com/de-de/library/windows/desktop/ms633515%28v=vs.85%29.aspx 11 | static HWNDFIRST := 0 12 | static HWNDLAST := 1 13 | static HWNDNEXT := 2 14 | static HWNDPREV := 3 15 | static OWNER := 4 16 | static CHILD := 5 17 | static ENABLEDPOPUP := 6 18 | static MAX := 6 19 | } 20 | ; Window field offsets for GetWindowLong() === (winuser.h) ============================================================= 21 | class GWL { 22 | ; http://msdn.microsoft.com/en-us/library/windows/desktop/ms633584%28v=vs.85%29.aspx 23 | static WNDPROC := -4 24 | static HINSTANCE := -6 25 | static HWNDPARENT := -8 26 | static ID := -12 27 | static STYLE := -16 28 | static EXSTYLE := -20 29 | static USERDATA := -21 30 | } 31 | 32 | ; LOWORD(wParam) values in WM_*UISTATE* === (winuser.h=) =============================================================== 33 | class UIS { 34 | ; http://msdn.microsoft.com/en-us/library/windows/desktop/ms646342%28v=vs.85%29.aspx 35 | static SET := 1 36 | static CLEAR := 2 37 | static INITIALIZE := 4 38 | } 39 | 40 | ; LOWORD(wParam) values in WM_*UISTATE* === (winuser.h=) =============================================================== 41 | class UISF { 42 | ; http://msdn.microsoft.com/en-us/library/windows/desktop/ms646342%28v=vs.85%29.aspx 43 | static ACTIVE := 0x4 44 | static HIDEACCEL := 0x2 45 | static HIDEFOCUS := 0x1 46 | } 47 | 48 | ; RedrawWindow() flags === (winuser.h) ================================================================================= 49 | class RDW { 50 | ; http://msdn.microsoft.com/en-us/library/windows/desktop/dd162911%28v=vs.85%29.aspx 51 | static INVALIDATE := 0x0001 52 | static INTERNALPAINT := 0x0002 53 | static ERASE := 0x0004 54 | static VALIDATE := 0x0008 55 | static NOINTERNALPAINT := 0x0010 56 | static NOERASE := 0x0020 57 | static NOCHILDREN := 0x0040 58 | static ALLCHILDREN := 0x0080 59 | static UPDATENOW := 0x0100 60 | static ERASENOW := 0x0200 61 | static FRAME := 0x0400 62 | static NOFRAME := 0x0800 63 | } 64 | 65 | ; Messages / notifications === (winuser.h) ============================================================================= 66 | class MN { 67 | ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms632613%28v=vs.85%29.aspx 68 | static GETHMENU := 0x01E1 69 | } 70 | 71 | class WM { 72 | static ACTIVATE := 0x0006 73 | static ACTIVATEAPP := 0x001C 74 | static AFXFIRST := 0x0360 75 | static AFXLAST := 0x037F 76 | static APP := 0x8000 77 | static APPCOMMAND := 0x0319 78 | static ASKCBFORMATNAME := 0x030C 79 | static CANCELMODE := 0x001F 80 | static CAPTURECHANGED := 0x0215 81 | static CHANGECBCHAIN := 0x030D 82 | static CHANGEUISTATE := 0x0127 83 | static CHAR := 0x0102 84 | static CHARTOITEM := 0x002F 85 | static CHILDACTIVATE := 0x0022 86 | static CLEAR := 0x0303 87 | static CLIPBOARDUPDATE := 0x031D 88 | static CLOSE := 0x0010 89 | static COMMAND := 0x0111 90 | static COMMNOTIFY := 0x0044 ; no longer suported 91 | static COMPACTING := 0x0041 92 | static COMPAREITEM := 0x0039 93 | static CONTEXTMENU := 0x007B 94 | static COPY := 0x0301 95 | static CREATE := 0x0001 96 | static CTLCOLORBTN := 0x0135 97 | static CTLCOLORDLG := 0x0136 98 | static CTLCOLOREDIT := 0x0133 99 | static CTLCOLORLISTBOX := 0x0134 100 | static CTLCOLORMSGBOX := 0x0132 101 | static CTLCOLORSCROLLBAR := 0x0137 102 | static CTLCOLORSTATIC := 0x0138 103 | static CUT := 0x0300 104 | static DEADCHAR := 0x0103 105 | static DELETEITEM := 0x002D 106 | static DESTROY := 0x0002 107 | static DESTROYCLIPBOARD := 0x0307 108 | static DEVICECHANGE := 0x0219 109 | static DEVMODECHANGE := 0x001B 110 | static DISPLAYCHANGE := 0x007E 111 | static DRAWCLIPBOARD := 0x0308 112 | static DRAWITEM := 0x002B 113 | static DROPFILES := 0x0233 114 | static DWMCOLORIZATIONCOLORCHANGED := 0x0320 ; >= Vista 115 | static DWMCOMPOSITIONCHANGED := 0x031E ; >= Vista 116 | static DWMNCRENDERINGCHANGED := 0x031F ; >= Vista 117 | static DWMSENDICONICLIVEPREVIEWBITMAP:= 0x0326 ; >= Win 7 118 | static DWMSENDICONICTHUMBNAIL := 0x0323 ; >= Win 7 119 | static DWMWINDOWMAXIMIZEDCHANGE := 0x0321 ; >= Vista 120 | static ENABLE := 0x000A 121 | static ENDSESSION := 0x0016 122 | static ENTERIDLE := 0x0121 123 | static ENTERMENULOOP := 0x0211 124 | static ENTERSIZEMOVE := 0x0231 125 | static ERASEBKGND := 0x0014 126 | static EXITMENULOOP := 0x0212 127 | static EXITSIZEMOVE := 0x0232 128 | static FONTCHANGE := 0x001D 129 | static GESTURE := 0x0119 ; >= Win 7 130 | static GESTURENOTIFY := 0x011A ; >= Win 7 131 | static GETDLGCODE := 0x0087 132 | static GETFONT := 0x0031 133 | static GETHOTKEY := 0x0033 134 | static GETICON := 0x007F 135 | static GETMINMAXINFO := 0x0024 136 | static GETOBJECT := 0x003D 137 | static GETTEXT := 0x000D 138 | static GETTEXTLENGTH := 0x000E 139 | static GETTITLEBARINFOEX := 0x033F ; >= Vista 140 | static HANDHELDFIRST := 0x0358 141 | static HANDHELDLAST := 0x035F 142 | static HELP := 0x0053 143 | static HOTKEY := 0x0312 144 | static HSCROLL := 0x0114 145 | static HSCROLLCLIPBOARD := 0x030E 146 | static ICONERASEBKGND := 0x0027 147 | static IME_CHAR := 0x0286 148 | static IME_COMPOSITION := 0x010F 149 | static IME_COMPOSITIONFULL := 0x0284 150 | static IME_CONTROL := 0x0283 151 | static IME_ENDCOMPOSITION := 0x010E 152 | static IME_KEYDOWN := 0x0290 153 | static IME_KEYLAST := 0x010F 154 | static IME_KEYUP := 0x0291 155 | static IME_NOTIFY := 0x0282 156 | static IME_REQUEST := 0x0288 157 | static IME_SELECT := 0x0285 158 | static IME_SETCONTEXT := 0x0281 159 | static IME_STARTCOMPOSITION := 0x010D 160 | static INITDIALOG := 0x0110 161 | static INITMENU := 0x0116 162 | static INITMENUPOPUP := 0x0117 163 | static INPUT := 0x00FF 164 | static INPUT_DEVICE_CHANGE := 0x00FE 165 | static INPUTLANGCHANGE := 0x0051 166 | static INPUTLANGCHANGEREQUEST := 0x0050 167 | static KEYDOWN := 0x0100 168 | static KEYLAST := 0x0109 169 | static KEYUP := 0x0101 170 | static KILLFOCUS := 0x0008 171 | static LBUTTONDBLCLK := 0x0203 172 | static LBUTTONDOWN := 0x0201 173 | static LBUTTONUP := 0x0202 174 | static MBUTTONDBLCLK := 0x0209 175 | static MBUTTONDOWN := 0x0207 176 | static MBUTTONUP := 0x0208 177 | static MDIACTIVATE := 0x0222 178 | static MDICASCADE := 0x0227 179 | static MDICREATE := 0x0220 180 | static MDIDESTROY := 0x0221 181 | static MDIGETACTIVE := 0x0229 182 | static MDIICONARRANGE := 0x0228 183 | static MDIMAXIMIZE := 0x0225 184 | static MDINEXT := 0x0224 185 | static MDIREFRESHMENU := 0x0234 186 | static MDIRESTORE := 0x0223 187 | static MDISETMENU := 0x0230 188 | static MDITILE := 0x0226 189 | static MEASUREITEM := 0x002C 190 | static MENUCHAR := 0x0120 191 | static MENUCOMMAND := 0x0126 192 | static MENUDRAG := 0x0123 193 | static MENUGETOBJECT := 0x0124 194 | static MENURBUTTONUP := 0x0122 195 | static MENUSELECT := 0x011F 196 | static MOUSEACTIVATE := 0x0021 197 | static MOUSEHOVER := 0x02A1 198 | static MOUSEHWHEEL := 0x020E ; >= Vista 199 | static MOUSELEAVE := 0x02A3 200 | static MOUSEMOVE := 0x0200 201 | static MOUSEWHEEL := 0x020A 202 | static MOVE := 0x0003 203 | static MOVING := 0x0216 204 | static NCACTIVATE := 0x0086 205 | static NCCALCSIZE := 0x0083 206 | static NCCREATE := 0x0081 207 | static NCDESTROY := 0x0082 208 | static NCHITTEST := 0x0084 209 | static NCLBUTTONDBLCLK := 0x00A3 210 | static NCLBUTTONDOWN := 0x00A1 211 | static NCLBUTTONUP := 0x00A2 212 | static NCMBUTTONDBLCLK := 0x00A9 213 | static NCMBUTTONDOWN := 0x00A7 214 | static NCMBUTTONUP := 0x00A8 215 | static NCMOUSEHOVER := 0x02A0 216 | static NCMOUSELEAVE := 0x02A2 217 | static NCMOUSEMOVE := 0x00A0 218 | static NCPAINT := 0x0085 219 | static NCRBUTTONDBLCLK := 0x00A6 220 | static NCRBUTTONDOWN := 0x00A4 221 | static NCRBUTTONUP := 0x00A5 222 | static NCXBUTTONDBLCLK := 0x00AD 223 | static NCXBUTTONDOWN := 0x00AB 224 | static NCXBUTTONUP := 0x00AC 225 | static NEXTDLGCTL := 0x0028 226 | static NEXTMENU := 0x0213 227 | static NOTIFY := 0x004E 228 | static NOTIFYFORMAT := 0x0055 229 | static NULL := 0x0000 230 | static PAINT := 0x000F 231 | static PAINTCLIPBOARD := 0x0309 232 | static PAINTICON := 0x0026 233 | static PALETTECHANGED := 0x0311 234 | static PALETTEISCHANGING := 0x0310 235 | static PARENTNOTIFY := 0x0210 236 | static PASTE := 0x0302 237 | static PENWINFIRST := 0x0380 238 | static PENWINLAST := 0x038F 239 | static POWER := 0x0048 240 | static POWERBROADCAST := 0x0218 241 | static PRINT := 0x0317 242 | static PRINTCLIENT := 0x0318 243 | static QUERYDRAGICON := 0x0037 244 | static QUERYENDSESSION := 0x0011 245 | static QUERYNEWPALETTE := 0x030F 246 | static QUERYOPEN := 0x0013 247 | static QUERYUISTATE := 0x0129 248 | static QUEUESYNC := 0x0023 249 | static QUIT := 0x0012 250 | static RBUTTONDBLCLK := 0x0206 251 | static RBUTTONDOWN := 0x0204 252 | static RBUTTONUP := 0x0205 253 | static RENDERALLFORMATS := 0x0306 254 | static RENDERFORMAT := 0x0305 255 | static SETCURSOR := 0x0020 256 | static SETFOCUS := 0x0007 257 | static SETFONT := 0x0030 258 | static SETHOTKEY := 0x0032 259 | static SETICON := 0x0080 260 | static SETREDRAW := 0x000B 261 | static SETTEXT := 0x000C 262 | static SETTINGCHANGE := 0x001A ; WM_WININICHANGE 263 | static SHOWWINDOW := 0x0018 264 | static SIZE := 0x0005 265 | static SIZECLIPBOARD := 0x030B 266 | static SIZING := 0x0214 267 | static SPOOLERSTATUS := 0x002A 268 | static STYLECHANGED := 0x007D 269 | static STYLECHANGING := 0x007C 270 | static SYNCPAINT := 0x0088 271 | static SYSCHAR := 0x0106 272 | static SYSCOLORCHANGE := 0x0015 273 | static SYSCOMMAND := 0x0112 274 | static SYSDEADCHAR := 0x0107 275 | static SYSKEYDOWN := 0x0104 276 | static SYSKEYUP := 0x0105 277 | static TABLET_FIRST := 0x02C0 278 | static TABLET_LAST := 0x02DF 279 | static TCARD := 0x0052 280 | static THEMECHANGED := 0x031A 281 | static TIMECHANGE := 0x001E 282 | static TIMER := 0x0113 283 | static TOUCH := 0x0240 ; >= Win 7 284 | static UNDO := 0x0304 285 | static UNICHAR := 0x0109 286 | static UNINITMENUPOPUP := 0x0125 287 | static UPDATEUISTATE := 0x0128 288 | static USER := 0x0400 289 | static USERCHANGED := 0x0054 290 | static VKEYTOITEM := 0x002E 291 | static VSCROLL := 0x0115 292 | static VSCROLLCLIPBOARD := 0x030A 293 | static WINDOWPOSCHANGED := 0x0047 294 | static WINDOWPOSCHANGING := 0x0046 295 | static WININICHANGE := 0x001A 296 | static WTSSESSION_CHANGE := 0x02B1 297 | static XBUTTONDBLCLK := 0x020D 298 | static XBUTTONDOWN := 0x020B 299 | static XBUTTONUP := 0x020C 300 | } 301 | 302 | ; Styles === (winuser.h) =============================================================================================== 303 | class WS { 304 | static BORDER := 0x00800000 305 | static CAPTION := 0x00C00000 ; WS_BORDER|WS_DLGFRAME 306 | static CHILD := 0x40000000 307 | static CLIPCHILDREN := 0x02000000 308 | static CLIPSIBLINGS := 0x04000000 309 | static DISABLED := 0x08000000 310 | static DLGFRAME := 0x00400000 311 | static GROUP := 0x00020000 312 | static HSCROLL := 0x00100000 313 | static ICONIC := 0x20000000 ; WS_MINIMIZE 314 | static MAXIMIZE := 0x01000000 315 | static MAXIMIZEBOX := 0x00010000 316 | static MINIMIZE := 0x20000000 317 | static MINIMIZEBOX := 0x00020000 318 | static OVERLAPPED := 0x00000000 319 | static POPUP := 0x80000000 320 | static SIZEBOX := 0x00040000 ; WS_THICKFRAME 321 | static SYSMENU := 0x00080000 322 | static TABSTOP := 0x00010000 323 | static THICKFRAME := 0x00040000 324 | static TILED := 0x00000000 ; WS_OVERLAPPED 325 | static VISIBLE := 0x10000000 326 | static VSCROLL := 0x00200000 327 | ; Common Window Styles 328 | static CHILDWINDOW := 0x40000000 ; WS_CHILD 329 | static OVERLAPPEDWINDOW := 0x00CF0000 ; WS_OVERLAPPED|CAPTION|SYSMENU|THICKFRAME|MINIMIZEBOX|MAXIMIZEBOX 330 | static POPUPWINDOW := 0x80880000 ; WS_POPUP|BORDER|SYSMENU 331 | static TILEDWINDOW := 0x00CF0000 ; WS_OVERLAPPEDWINDOW 332 | 333 | class EX { 334 | ; ExStyles ============================================================================================================= 335 | static ACCEPTFILES := 0x00000010 336 | static APPWINDOW := 0x00040000 337 | static CLIENTEDGE := 0x00000200 338 | static COMPOSITED := 0x02000000 339 | static CONTEXTHELP := 0x00000400 340 | static CONTROLPARENT := 0x00010000 341 | static DLGMODALFRAME := 0x00000001 342 | static LAYERED := 0x00080000 343 | static LAYOUTRTL := 0x00400000 ; Right to left mirroring 344 | static LEFT := 0x00000000 345 | static LEFTSCROLLBAR := 0x00004000 346 | static LTRREADING := 0x00000000 347 | static MDICHILD := 0x00000040 348 | static NOACTIVATE := 0x08000000 349 | static NOINHERITLAYOUT := 0x00100000 ; Disable inheritence of mirroring by children 350 | static NOPARENTNOTIFY := 0x00000004 351 | static RIGHT := 0x00001000 352 | static RIGHTSCROLLBAR := 0x00000000 353 | static RTLREADING := 0x00002000 354 | static STATICEDGE := 0x00020000 355 | static TOOLWINDOW := 0x00000080 356 | static TOPMOST := 0x00000008 357 | static TRANSPARENT := 0x00000020 358 | static CLICKTHROUGH := 0x00000020 ; http://stackoverflow.com/questions/1524035/topmost-form-clicking-through-possible 359 | static WINDOWEDGE := 0x00000100 360 | static OVERLAPPEDWINDOW := 0x00000300 ; WS_EX_WINDOWEDGE|EX_CLIENTEDGE 361 | static PALETTEWINDOW := 0x00000188 ; WS_EX_WINDOWEDGE|EX_TOOLWINDOW|EX_TOPMOST 362 | } 363 | } 364 | 365 | ; Parameter for SystemParametersInfo === (winuser.h) =================================================================== 366 | class SPI { 367 | static GETBEEP := 0x0001 368 | static SETBEEP := 0x0002 369 | static GETMOUSE := 0x0003 370 | static SETMOUSE := 0x0004 371 | static GETBORDER := 0x0005 372 | static SETBORDER := 0x0006 373 | static GETKEYBOARDSPEED := 0x000A 374 | static SETKEYBOARDSPEED := 0x000B 375 | static LANGDRIVER := 0x000C 376 | static ICONHORIZONTALSPACING := 0x000D 377 | static GETSCREENSAVETIMEOUT := 0x000E 378 | static SETSCREENSAVETIMEOUT := 0x000F 379 | static GETSCREENSAVEACTIVE := 0x0010 380 | static SETSCREENSAVEACTIVE := 0x0011 381 | static GETGRIDGRANULARITY := 0x0012 382 | static SETGRIDGRANULARITY := 0x0013 383 | static SETDESKWALLPAPER := 0x0014 384 | static SETDESKPATTERN := 0x0015 385 | static GETKEYBOARDDELAY := 0x0016 386 | static SETKEYBOARDDELAY := 0x0017 387 | static ICONVERTICALSPACING := 0x0018 388 | static GETICONTITLEWRAP := 0x0019 389 | static SETICONTITLEWRAP := 0x001A 390 | static GETMENUDROPALIGNMENT := 0x001B 391 | static SETMENUDROPALIGNMENT := 0x001C 392 | static SETDOUBLECLKWIDTH := 0x001D 393 | static SETDOUBLECLKHEIGHT := 0x001E 394 | static GETICONTITLELOGFONT := 0x001F 395 | static SETDOUBLECLICKTIME := 0x0020 396 | static SETMOUSEBUTTONSWAP := 0x0021 397 | static SETICONTITLELOGFONT := 0x0022 398 | static GETFASTTASKSWITCH := 0x0023 399 | static SETFASTTASKSWITCH := 0x0024 400 | static SETDRAGFULLWINDOWS := 0x0025 401 | static GETDRAGFULLWINDOWS := 0x0026 402 | static GETNONCLIENTMETRICS := 0x0029 403 | static SETNONCLIENTMETRICS := 0x002A 404 | static GETMINIMIZEDMETRICS := 0x002B 405 | static SETMINIMIZEDMETRICS := 0x002C 406 | static GETICONMETRICS := 0x002D 407 | static SETICONMETRICS := 0x002E 408 | static SETWORKAREA := 0x002F 409 | static GETWORKAREA := 0x0030 410 | static SETPENWINDOWS := 0x0031 411 | static GETHIGHCONTRAST := 0x0042 412 | static SETHIGHCONTRAST := 0x0043 413 | static GETKEYBOARDPREF := 0x0044 414 | static SETKEYBOARDPREF := 0x0045 415 | static GETSCREENREADER := 0x0046 416 | static SETSCREENREADER := 0x0047 417 | static GETANIMATION := 0x0048 418 | static SETANIMATION := 0x0049 419 | static GETFONTSMOOTHING := 0x004A 420 | static SETFONTSMOOTHING := 0x004B 421 | static SETDRAGWIDTH := 0x004C 422 | static SETDRAGHEIGHT := 0x004D 423 | static SETHANDHELD := 0x004E 424 | static GETLOWPOWERTIMEOUT := 0x004F 425 | static GETPOWEROFFTIMEOUT := 0x0050 426 | static SETLOWPOWERTIMEOUT := 0x0051 427 | static SETPOWEROFFTIMEOUT := 0x0052 428 | static GETLOWPOWERACTIVE := 0x0053 429 | static GETPOWEROFFACTIVE := 0x0054 430 | static SETLOWPOWERACTIVE := 0x0055 431 | static SETPOWEROFFACTIVE := 0x0056 432 | static SETCURSORS := 0x0057 433 | static SETICONS := 0x0058 434 | static GETDEFAULTINPUTLANG := 0x0059 435 | static SETDEFAULTINPUTLANG := 0x005A 436 | static SETLANGTOGGLE := 0x005B 437 | static GETWINDOWSEXTENSION := 0x005C 438 | static SETMOUSETRAILS := 0x005D 439 | static GETMOUSETRAILS := 0x005E 440 | static SETSCREENSAVERRUNNING := 0x0061 441 | static SCREENSAVERRUNNING := 0x0061 ; SPI_SETSCREENSAVERRUNNING 442 | static GETFILTERKEYS := 0x0032 443 | static SETFILTERKEYS := 0x0033 444 | static GETTOGGLEKEYS := 0x0034 445 | static SETTOGGLEKEYS := 0x0035 446 | static GETMOUSEKEYS := 0x0036 447 | static SETMOUSEKEYS := 0x0037 448 | static GETSHOWSOUNDS := 0x0038 449 | static SETSHOWSOUNDS := 0x0039 450 | static GETSTICKYKEYS := 0x003A 451 | static SETSTICKYKEYS := 0x003B 452 | static GETACCESSTIMEOUT := 0x003C 453 | static SETACCESSTIMEOUT := 0x003D 454 | static GETSERIALKEYS := 0x003E 455 | static SETSERIALKEYS := 0x003F 456 | static GETSOUNDSENTRY := 0x0040 457 | static SETSOUNDSENTRY := 0x0041 458 | static GETSNAPTODEFBUTTON := 0x005F 459 | static SETSNAPTODEFBUTTON := 0x0060 460 | static GETMOUSEHOVERWIDTH := 0x0062 461 | static SETMOUSEHOVERWIDTH := 0x0063 462 | static GETMOUSEHOVERHEIGHT := 0x0064 463 | static SETMOUSEHOVERHEIGHT := 0x0065 464 | static GETMOUSEHOVERTIME := 0x0066 465 | static SETMOUSEHOVERTIME := 0x0067 466 | static GETWHEELSCROLLLINES := 0x0068 467 | static SETWHEELSCROLLLINES := 0x0069 468 | static GETMENUSHOWDELAY := 0x006A 469 | static SETMENUSHOWDELAY := 0x006B 470 | static GETWHEELSCROLLCHARS := 0x006C 471 | static SETWHEELSCROLLCHARS := 0x006D 472 | static GETSHOWIMEUI := 0x006E 473 | static SETSHOWIMEUI := 0x006F 474 | static GETMOUSESPEED := 0x0070 475 | static SETMOUSESPEED := 0x0071 476 | static GETSCREENSAVERRUNNING := 0x0072 477 | static GETDESKWALLPAPER := 0x0073 478 | static GETAUDIODESCRIPTION := 0x0074 479 | static SETAUDIODESCRIPTION := 0x0075 480 | static GETSCREENSAVESECURE := 0x0076 481 | static SETSCREENSAVESECURE := 0x0077 482 | static GETHUNGAPPTIMEOUT := 0x0078 483 | static SETHUNGAPPTIMEOUT := 0x0079 484 | static GETWAITTOKILLTIMEOUT := 0x007A 485 | static SETWAITTOKILLTIMEOUT := 0x007B 486 | static GETWAITTOKILLSERVICETIMEOUT := 0x007C 487 | static SETWAITTOKILLSERVICETIMEOUT := 0x007D 488 | static GETMOUSEDOCKTHRESHOLD := 0x007E 489 | static SETMOUSEDOCKTHRESHOLD := 0x007F 490 | static GETPENDOCKTHRESHOLD := 0x0080 491 | static SETPENDOCKTHRESHOLD := 0x0081 492 | static GETWINARRANGING := 0x0082 493 | static SETWINARRANGING := 0x0083 494 | static GETMOUSEDRAGOUTTHRESHOLD := 0x0084 495 | static SETMOUSEDRAGOUTTHRESHOLD := 0x0085 496 | static GETPENDRAGOUTTHRESHOLD := 0x0086 497 | static SETPENDRAGOUTTHRESHOLD := 0x0087 498 | static GETMOUSESIDEMOVETHRESHOLD := 0x0088 499 | static SETMOUSESIDEMOVETHRESHOLD := 0x0089 500 | static GETPENSIDEMOVETHRESHOLD := 0x008A 501 | static SETPENSIDEMOVETHRESHOLD := 0x008B 502 | static GETDRAGFROMMAXIMIZE := 0x008C 503 | static SETDRAGFROMMAXIMIZE := 0x008D 504 | static GETSNAPSIZING := 0x008E 505 | static SETSNAPSIZING := 0x008F 506 | static GETDOCKMOVING := 0x0090 507 | static SETDOCKMOVING := 0x0091 508 | static GETACTIVEWINDOWTRACKING := 0x1000 509 | static SETACTIVEWINDOWTRACKING := 0x1001 510 | static GETMENUANIMATION := 0x1002 511 | static SETMENUANIMATION := 0x1003 512 | static GETCOMBOBOXANIMATION := 0x1004 513 | static SETCOMBOBOXANIMATION := 0x1005 514 | static GETLISTBOXSMOOTHSCROLLING := 0x1006 515 | static SETLISTBOXSMOOTHSCROLLING := 0x1007 516 | static GETGRADIENTCAPTIONS := 0x1008 517 | static SETGRADIENTCAPTIONS := 0x1009 518 | static GETKEYBOARDCUES := 0x100A 519 | static SETKEYBOARDCUES := 0x100B 520 | static GETMENUUNDERLINES := 0x100A ; SPI_GETKEYBOARDCUES 521 | static SETMENUUNDERLINES := 0x100A ; SPI_SETKEYBOARDCUES 522 | static GETACTIVEWNDTRKZORDER := 0x100C 523 | static SETACTIVEWNDTRKZORDER := 0x100D 524 | static GETHOTTRACKING := 0x100E 525 | static SETHOTTRACKING := 0x100F 526 | static GETMENUFADE := 0x1012 527 | static SETMENUFADE := 0x1013 528 | static GETSELECTIONFADE := 0x1014 529 | static SETSELECTIONFADE := 0x1015 530 | static GETTOOLTIPANIMATION := 0x1016 531 | static SETTOOLTIPANIMATION := 0x1017 532 | static GETTOOLTIPFADE := 0x1018 533 | static SETTOOLTIPFADE := 0x1019 534 | static GETCURSORSHADOW := 0x101A 535 | static SETCURSORSHADOW := 0x101B 536 | static GETMOUSESONAR := 0x101C 537 | static SETMOUSESONAR := 0x101D 538 | static GETMOUSECLICKLOCK := 0x101E 539 | static SETMOUSECLICKLOCK := 0x101F 540 | static GETMOUSEVANISH := 0x1020 541 | static SETMOUSEVANISH := 0x1021 542 | static GETFLATMENU := 0x1022 543 | static SETFLATMENU := 0x1023 544 | static GETDROPSHADOW := 0x1024 545 | static SETDROPSHADOW := 0x1025 546 | static GETBLOCKSENDINPUTRESETS := 0x1026 547 | static SETBLOCKSENDINPUTRESETS := 0x1027 548 | static GETUIEFFECTS := 0x103E 549 | static SETUIEFFECTS := 0x103F 550 | static GETDISABLEOVERLAPPEDCONTENT := 0x1040 551 | static SETDISABLEOVERLAPPEDCONTENT := 0x1041 552 | static GETCLIENTAREAANIMATION := 0x1042 553 | static SETCLIENTAREAANIMATION := 0x1043 554 | static GETCLEARTYPE := 0x1048 555 | static SETCLEARTYPE := 0x1049 556 | static GETSPEECHRECOGNITION := 0x104A 557 | static SETSPEECHRECOGNITION := 0x104B 558 | static GETFOREGROUNDLOCKTIMEOUT := 0x2000 559 | static SETFOREGROUNDLOCKTIMEOUT := 0x2001 560 | static GETACTIVEWNDTRKTIMEOUT := 0x2002 561 | static SETACTIVEWNDTRKTIMEOUT := 0x2003 562 | static GETFOREGROUNDFLASHCOUNT := 0x2004 563 | static SETFOREGROUNDFLASHCOUNT := 0x2005 564 | static GETCARETWIDTH := 0x2006 565 | static SETCARETWIDTH := 0x2007 566 | static GETMOUSECLICKLOCKTIME := 0x2008 567 | static SETMOUSECLICKLOCKTIME := 0x2009 568 | static GETFONTSMOOTHINGTYPE := 0x200A 569 | static SETFONTSMOOTHINGTYPE := 0x200B 570 | } 571 | 572 | ; ====================================================================================================================== -------------------------------------------------------------------------------- /lib/Windy/Mony.ahk: -------------------------------------------------------------------------------- 1 | ; ****** HINT: Documentation can be extracted to HTML using NaturalDocs (http://www.naturaldocs.org/) ************** 2 | 3 | ; ****** HINT: Debug-lines should contain "; _DBG_" at the end of lines - using this, the debug lines could be automatically removed through scripts before releasing the sourcecode 4 | 5 | #include %A_LineFile%\.. 6 | #include Recty.ahk 7 | #include Pointy.ahk 8 | #include MultiMony.ahk 9 | 10 | /* ****************************************************************************************************************************************** 11 | Class: Mony 12 | Handling a single Monitor, identified via its monitor ID 13 | 14 | Authors: 15 | : Original 16 | 17 | About: License 18 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details. 19 | 20 | */ 21 | class Mony { 22 | _debug := 0 23 | _version := "1.0.1" 24 | _id := 0 25 | _hmon := 0 26 | 27 | ; ===== Properties =============================================================== 28 | boundary[] { 29 | /* ------------------------------------------------------------------------------- 30 | Property: boundary [get] 31 | Get the boundaries of a monitor in Pixel (related to Virtual Screen) as a . 32 | 33 | Remarks: 34 | * There is no setter available, since this is a constant system property 35 | 36 | See Also: 37 | 38 | */ 39 | get { 40 | mon := this.id 41 | SysGet, size, Monitor, %mon% 42 | rect := new Recty(sizeLeft, sizeTop, sizeRight, sizeBottom, this._debug) 43 | if (this._debug) ; _DBG_ 44 | OutputDebug % "<[" A_ThisFunc "([" this.id "])] -> (" rect.dump() ")" ; _DBG_ 45 | return rect 46 | } 47 | } 48 | center[] { 49 | /* ------------------------------------------------------------------------------- 50 | Property: center [get] 51 | Get the center coordinates of a monitor in Pixel (related to Virtual Screen) as a . 52 | 53 | Remarks: 54 | * There is no setter available, since this is a constant system property 55 | */ 56 | get { 57 | boundary := this.boundary 58 | xcenter := floor(boundary.x+(boundary.w-boundary.x)/2) 59 | ycenter := floor(boundary.y+(boundary.h-boundary.y)/2) 60 | pt := new Pointy(xcenter, ycenter, this._debug) 61 | if (this._debug) ; _DBG_ 62 | OutputDebug % "|[" A_ThisFunc "([" this.id "])] -> (" pt.dump() ")" ; _DBG_ 63 | return pt 64 | } 65 | } 66 | debug[] { ; _DBG_ 67 | /* ------------------------------------------------------------------------------- 68 | Property: debug [get/set] 69 | Debug flag for debugging the object 70 | 71 | Value: 72 | flag - *true* or *false* 73 | */ 74 | get { ; _DBG_ 75 | return this._debug ; _DBG_ 76 | } ; _DBG_ 77 | set { ; _DBG_ 78 | mode := value<1?0:1 ; _DBG_ 79 | this._debug := mode ; _DBG_ 80 | return this._debug ; _DBG_ 81 | } ; _DBG_ 82 | } 83 | hmon[] { 84 | /* ------------------------------------------------------------------------------- 85 | Property: hmon [get] 86 | Get the handle of the monitor 87 | 88 | Remarks: 89 | * There is no setter available, since this is a constant system property 90 | */ 91 | get { 92 | md := new MultiMony(this._debug) 93 | rect := this.boundary 94 | X := rect.x + 1 95 | Y := rect.y + 1 96 | hmon := DllCall("User32.dll\MonitorFromPoint", "Int64", (X & 0xFFFFFFFF) | (Y << 32), "UInt", 0, "UPtr") 97 | this._hmon := hmon 98 | if (this._debug) ; _DBG_ 99 | OutputDebug % "|[" A_ThisFunc "([" this.id "])] -> (" this._hmon ")" ; _DBG_ 100 | return this._hmon 101 | } 102 | } 103 | id[] { 104 | /* ------------------------------------------------------------------------------- 105 | Property: id [get/set] 106 | ID of the monitor 107 | */ 108 | get { 109 | return this._id 110 | } 111 | set { 112 | if (this._debug) ; _DBG_ 113 | OutputDebug % ">[" A_ThisFunc "([" this.id "],value:=" value ")]" ; _DBG_ 114 | ret := 0 115 | ; Existiert der Monitor mit der uebergebenen ID? 116 | CoordMode, Mouse, Screen 117 | SysGet, mCnt, MonitorCount 118 | if (value > 0) { 119 | if (value <= mCnt) { 120 | this._id := value 121 | ret := value 122 | } 123 | } 124 | if (this._debug) ; _DBG_ 125 | OutputDebug % "<[" A_ThisFunc "([" this.id "],value:=" value ")] -> (" ret ")" ; _DBG_ 126 | return ret 127 | } 128 | } 129 | idNext[ cycle := true ] { 130 | /* ------------------------------------------------------------------------------- 131 | Property: idNext [get] 132 | Gets the id of the next monitor. 133 | 134 | Parameters: 135 | cycle - == 1 cycle through monitors; == 0 stop at last monitor (*Optional*, Default: 1) 136 | 137 | Remarks: 138 | * There is no setter available, since this is a constant system property 139 | 140 | See Also: 141 | 142 | */ 143 | get { 144 | md := new MultiMony(this._debug) 145 | nextMon := md.idNext(this.id, cycle) 146 | if (this._debug) ; _DBG_ 147 | OutputDebug % "|[" A_ThisFunc "([" this.id "],cycle=" cycle ")] -> " nextMon ; _DBG_ 148 | 149 | return nextMon 150 | } 151 | } 152 | idPrev[ cycle := true ] { 153 | /* ------------------------------------------------------------------------------- 154 | Property: idPrev [get] 155 | Gets the id of the previous monitor 156 | 157 | Parameters: 158 | cycle - == true cycle through monitors; == false stop at last monitor (*Optional*, Default: true) 159 | 160 | Remarks: 161 | * There is no setter available, since this is a constant system property 162 | 163 | See Also: 164 | 165 | */ 166 | get { 167 | md := new MultiMony(this._debug) 168 | prevMon := md.idPrev(this.id, cycle) 169 | if (this._debug) ; _DBG_ 170 | OutputDebug % "|[" A_ThisFunc "([" this.id "],cycle=" cycle ")] -> " prevMon ; _DBG_ 171 | 172 | return prevMon 173 | } 174 | } 175 | info[] { 176 | /* ------------------------------------------------------------------------------- 177 | Property: info [get] 178 | Gets info about monitor by calling Win32-API GetMonitorInfo() . 179 | 180 | More infos on GetMonitorInfo see 181 | 182 | The return value is an object containing 183 | 184 | * Monitor handle 185 | * Monitor name 186 | * Monitor Id 187 | * Rectangle containing the Monitor Boundaries (relative to Virtual Screen) 188 | * Rectangle containing the Monitor WorkingArea (relative to Virtual Screen) 189 | * Flag to indicate whether monitor is primary monitor or not ... 190 | 191 | Remarks: 192 | * There is no setter available, since this is a constant system property 193 | 194 | Authors: 195 | * Original: 196 | */ 197 | get { 198 | hmon := this.hmon 199 | ret := false 200 | NumPut(VarSetCapacity(MIEX, 40 + (32 << !!A_IsUnicode)), MIEX, 0, "UInt") 201 | If DllCall("User32.dll\GetMonitorInfo", "Ptr", hmon, "Ptr", &MIEX) { 202 | MonName := StrGet(&MIEX + 40, 32) ; CCHDEVICENAME = 32 203 | MonNum := RegExReplace(MonName, ".*(\d+)$", "$1") 204 | 205 | x := NumGet(MIEX, 4, "Int") 206 | y := NumGet(MIEX, 8, "Int") 207 | w := NumGet(MIEX, 12, "Int") 208 | h := NumGet(MIEX, 16, "Int") 209 | rectBound := new Recty(x,y,w,h,this.debug) 210 | 211 | x := NumGet(MIEX, 20, "Int") 212 | y := NumGet(MIEX, 24, "Int") 213 | w := NumGet(MIEX, 28, "Int") 214 | h := NumGet(MIEX, 32, "Int") 215 | rectWA := new Recty(x,y,w,h,this.debug) 216 | 217 | ret := { hmon: hmon 218 | , Name: MonName 219 | , Id: MonNum 220 | , Boundary: rectBound ; display rectangle 221 | , WorkingAreaVS: rectWA ; work area 222 | , Primary: NumGet(MIEX, 36, "UInt")} ; contains a non-zero value for the primary monitor. 223 | if (this._debug) ; _DBG_ 224 | OutputDebug % "|[" A_ThisFunc "([" this.id "])] -> (hmon=" ret.hmon ", Name=" ret.Name ", id=" ret.Id ", Boundary=" ret.Boundary.dump() ", WorkingArea" ret.WorkingArea.dump() ", Primary=" ret.Primary ")" ; _DBG_ 225 | } 226 | else { 227 | if (this._debug) ; _DBG_ 228 | OutputDebug % "|[" A_ThisFunc "([" this.id "])] -> " ret ; _DBG_ 229 | } 230 | Return ret 231 | } 232 | } 233 | monitorsCount[] { 234 | /* --------------------------------------------------------------------------------------- 235 | Property: monitorsCount [get] 236 | Number of available monitors. 237 | 238 | Remarks: 239 | * There is no setter available, since this is a constant system property 240 | */ 241 | get { 242 | md := new MultiMony(this._debug) 243 | mcnt := md.monitorsCount 244 | if (this._debug) ; _DBG_ 245 | OutputDebug % "|[" A_ThisFunc "([" this.id "]) -> (" mCnt ")]" ; _DBG_ 246 | return mCnt 247 | } 248 | } 249 | primary[] { 250 | /* --------------------------------------------------------------------------------------- 251 | Property: primary [get] 252 | Is the monitor the primary monitor? 253 | 254 | Remarks: 255 | * There is no setter available, since this is a constant system property 256 | */ 257 | get { 258 | info := this.info 259 | ret := info.primary 260 | if (this._debug) ; _DBG_ 261 | OutputDebug % "|[" A_ThisFunc "([" this.id "]) -> (" ret ")]" ; _DBG_ 262 | return ret 263 | } 264 | } 265 | scale[ monDest := 1 ] { 266 | /* ------------------------------------------------------------------------------- 267 | Property: scale [get] 268 | Determines the scaling factors in x/y-direction for coordinates when moving to monDest as a . 269 | 270 | Parameters: 271 | monDest - Destination Monitor number (*Required*, Default := 1) 272 | 273 | Returns: 274 | Scaling factor for x/y -coordinates as a . 275 | 276 | Remarks: 277 | * There is no setter available, since this is a constant system property 278 | 279 | See Also: 280 | , 281 | */ 282 | get { 283 | scaleX := this.scaleX(monDest) 284 | scaleY := this.scaleY(monDest) 285 | pt := new Pointy(scaleX,scaleY,this._debug) 286 | if (this._debug) ; _DBG_ 287 | OutputDebug % "|[" A_ThisFunc "([" this.id "],monDest:= " monDest "] -> (" pt.dump() ")" ; _DBG_ 288 | return pt 289 | } 290 | } 291 | scaleX[ monDest := 1 ] { 292 | /* ------------------------------------------------------------------------------- 293 | Property: scaleX [get] 294 | Determines the scaling factor in x and -direction for coordinates when moving to monDest 295 | 296 | Parameters: 297 | monDest - Destination Monitor number (*Required*, Default := 1) 298 | 299 | Returns: 300 | Scaling factor for x-coordinates as a . 301 | 302 | Remarks: 303 | * There is no setter available, since this is a constant system property 304 | 305 | See Also: 306 | , 307 | */ 308 | get { 309 | size1 := this.size 310 | md := new Mony(monDest, this.debug) 311 | size2 := md.size 312 | scaleX := size2.w / size1.w 313 | if (this._debug) ; _DBG_ 314 | OutputDebug % "|[" A_ThisFunc "([" this.id "],monDest:=" monDest ") -> (" scaleX ")]" ; _DBG_ 315 | return scaleX 316 | } 317 | } 318 | scaleY[ monDest := 1 ] { 319 | /* ------------------------------------------------------------------------------- 320 | Property: scaleY [get] 321 | Determines the scaling factor in y-direction for coordinates when moving to monDest 322 | 323 | Parameters: 324 | monDest - Destination Monitor number (*Required*, Default := 1) 325 | 326 | Returns: 327 | Scaling factor for y-coordinates 328 | 329 | Remarks: 330 | * There is no setter available, since this is a constant system property 331 | 332 | See Also: 333 | , 334 | */ 335 | get { 336 | size1 := this.size 337 | md := new Mony(monDest, this.debug) 338 | size2 := md.size 339 | scaleY := size2.h / size1.h 340 | if (this._debug) ; _DBG_ 341 | OutputDebug % "|[" A_ThisFunc "([" this.id "],monDest:=" monDest ") -> (" scaleY ")]" ; _DBG_ 342 | return scaleY 343 | } 344 | } 345 | size[] { 346 | /* --------------------------------------------------------------------------------------- 347 | Property: size [get] 348 | Get the size of a monitor in Pixel as a . 349 | 350 | Remarks: 351 | * There is no setter available, since this is a constant system property 352 | 353 | See Also: 354 | , 355 | */ 356 | get { 357 | mon := this.id 358 | SysGet, size, Monitor, %mon% 359 | rect := new Recty(0,0, sizeRight-sizeLeft, sizeBottom-sizeTop, this.debug) 360 | if (this._debug) ; _DBG_ 361 | OutputDebug % "|[" A_ThisFunc "([" this.id "])] -> (" rect.dump() ")" ; _DBG_ 362 | return rect 363 | } 364 | } 365 | version[] { 366 | /* ------------------------------------------------------------------------------- 367 | Property: version [get] 368 | Version of the class 369 | 370 | Remarks: 371 | * There is no setter available, since this is a constant system property 372 | */ 373 | get { 374 | return this._version 375 | } 376 | } 377 | virtualScreenSize[] { 378 | /* --------------------------------------------------------------------------------------- 379 | Property: virtualScreenSize [get] 380 | Get the size of virtual screen in Pixel as a . 381 | 382 | The virtual screen is the bounding rectangle of all display monitors 383 | 384 | Remarks: 385 | * There is no setter available, since this is a constant system property 386 | 387 | See Also: 388 | , 389 | */ 390 | get { 391 | md := new MultiMony(this._debug) 392 | rect := md.virtualScreenSize 393 | if (this._debug) ; _DBG_ 394 | OutputDebug % "<[" A_ThisFunc "([" this.id "])] -> (" rect.dump() ")" ; _DBG_ 395 | return rect 396 | } 397 | } 398 | workingArea[] { 399 | /* ------------------------------------------------------------------------------- 400 | Property: workingArea [get] 401 | Get the working area of a monitor in Pixel as a . 402 | 403 | Same as , except the area is reduced to exclude the area occupied by the taskbar and other registered desktop toolbars. 404 | The working area is given as a . 405 | 406 | Remarks: 407 | * There is no setter available, since this is a constant system property 408 | 409 | See Also: 410 | 411 | */ 412 | get { 413 | mon := this.id 414 | SysGet, size, MonitorWorkArea , %mon% 415 | rect := new Recty(0,0, sizeRight-sizeLeft, sizeBottom-sizeTop, this._debug) 416 | if (this._debug) ; _DBG_ 417 | OutputDebug % "|[" A_ThisFunc "([" this.id "])] -> (" rect.dump() ")" ; _DBG_ 418 | return rect 419 | } 420 | } 421 | 422 | ; ===== Methods ================================================================== 423 | /* ------------------------------------------------------------------------------- 424 | Method: coordDisplayToVirtualScreen 425 | Transforms coordinates relative to given monitor into absolute (virtual) coordinates. Returns object of type . 426 | 427 | Parameters: 428 | x,y - relative coordinates on given monitor 429 | 430 | Returns: 431 | . 432 | */ 433 | coordDisplayToVirtualScreen( x := 0, y := 0) { 434 | md := new MultiMony(this._debug) 435 | pt := md.coordDisplayToVirtualScreen(this.id, x, y) 436 | if (this._debug) ; _DBG_ 437 | OutputDebug % "|[" A_ThisFunc "()] -> (" pt.dump() ")" ; _DBG_ 438 | return pt 439 | } 440 | 441 | /* ------------------------------------------------------------------------------- 442 | method: identify 443 | Identify monitor by displaying the monitor id 444 | 445 | Parameters: 446 | disptime - time to display the monitor id (*Optional*, Default: 1500[ms]) 447 | txtcolor - color of the displayed monitor id (*Optional*, Default: "000000") 448 | txtsize - size of the displayed monitor id (*Optional*, Default: 300[px]) 449 | */ 450 | identify( disptime := 1500, txtcolor := "000000", txtsize := 300 ) { 451 | if (this._debug) ; _DBG_ 452 | OutputDebug % ">[" A_ThisFunc "([" this.id "], disptime := " disptime ", txtcolor := " txtcolor ", txtsize := " txtsize ")]" ; _DBG_ 453 | this.__idShow(txtcolor, txtsize) 454 | Sleep, %disptime% 455 | this.__idHide() 456 | if (this._debug) ; _DBG_ 457 | OutputDebug % "<[" A_ThisFunc "([" this.id "], disptime := " disptime ", txtcolor := " txtcolor ", txtsize := " txtsize ")]" ; _DBG_ 458 | return 459 | } 460 | 461 | /* --------------------------------------------------------------------------------------- 462 | Method: rectToPercent 463 | calculates monitor percents from given rectangle. 464 | 465 | The given rectangle-coordinates are transformed into percent of the screen. For example on a 1920x1200 screen the coordinates x=394,y=240,w=960,h=400 are transformed into 466 | (20, 20, 50, 33.33) because 394/1920 = 20%, 240/1200=20%, 960/1920=50%, 400/1200=33.33% 467 | 468 | Parameters: 469 | x,y,w,h - position and width/height to be transformed into screen percents 470 | 471 | Returns: 472 | containing screen percents. 473 | */ 474 | rectToPercent(rect) { 475 | monBound := this.boundary 476 | 477 | wfactor := (rect.w/monBound.w)*100 478 | hfactor := (rect.h/monBound.h)*100 479 | xfactor := (rect.x/monBound.w)*100 480 | yfactor := (rect.y/monBound.h)*100 481 | 482 | ret := new Recty(xfactor, yfactor, wfactor, hfactor, this._debug) 483 | 484 | if (this._debug) ; _DBG_ 485 | OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], rect=(" rect.Dump()")] -> percent=(" ret.Dump() ")" ; _DBG_ 486 | 487 | return ret 488 | } 489 | 490 | ; ===== Internal Methods ========================================================= 491 | /*! ------------------------------------------------------------------------------- 492 | method: __idHide 493 | Helper function for : Hides the Id, shown with <__idShow> (*INTERNAL*) 494 | 495 | See Also: 496 | , <__idShow> 497 | */ 498 | __idHide() { 499 | mon := this.id 500 | GuiNum := 80 + mon 501 | Gui, %GuiNum%:Destroy 502 | 503 | if (this._debug) ; _DBG_ 504 | OutputDebug % "|[" A_ThisFunc "([" this.id "])]" ; _DBG_ 505 | 506 | return 507 | } 508 | /*! ------------------------------------------------------------------------------- 509 | method: __idShow 510 | Helper function for : Identify monitor by displaying the monitor id, hidden via <__idHide> (*INTERNAL*) 511 | 512 | Parameters: 513 | txtcolor - color of the displayed monitor id (*Optional*, Default: "000000") 514 | txtsize - size of the displayed monitor id (*Optional*, Default: 300[px]) 515 | 516 | Authors: 517 | * Original: 518 | 519 | See Also: 520 | , <__idHide> 521 | */ 522 | __idShow( txtcolor := "000000", txtsize := 300 ) { 523 | mon := this.id 524 | TPColor = AABBCC 525 | GuiNum := 80 + mon 526 | SysGet, out, Monitor, %mon% 527 | x := outLeft 528 | Gui, %GuiNum%:+LastFound +AlwaysOnTop -Caption +ToolWindow 529 | Gui, %GuiNum%:Color, %TPColor% 530 | WinSet, TransColor, %TPColor% 531 | Gui, %GuiNum%:Font, s%txtsize% w700 532 | Gui, %GuiNum%:Add, Text, x0 y0 c%txtcolor%, %mon% 533 | Gui, %GuiNum%:Show, x%x% y0 NoActivate 534 | if (this._debug) ; _DBG_ 535 | OutputDebug % "|[" A_ThisFunc "([" this.id "], txtcolor := " txtcolor ", txtsize := " txtsize ")]" ; _DBG_ 536 | return 537 | } 538 | /* ------------------------------------------------------------------------------- 539 | Constructor: __New 540 | Constructor (*INTERNAL*) 541 | 542 | Parameters: 543 | _id - Monitor ID 544 | _debug - Flag to enable debugging (Optional - Default: 0) 545 | */ 546 | __New(_id := 1, _debug := false) { 547 | this._debug := _debug ; _DBG_ 548 | ret := true 549 | CoordMode, Mouse, Screen 550 | SysGet, mCnt, MonitorCount 551 | if (_id > 0) { 552 | if (_id <= mCnt) { 553 | this.id := _id 554 | } 555 | else { 556 | if (this.debug) ; _DBG_ 557 | OutputDebug % "|[" A_ThisFunc "(_id:=" _id ", _debug:=" _debug ")] (version: " this.version ") -> " false ; _DBG_ 558 | return false 559 | } 560 | } 561 | else { 562 | if (this.debug) ; _DBG_ 563 | OutputDebug % "|[" A_ThisFunc "(_id:=" _id ", _debug:=" _debug ")] (version: " this.version ") -> " false ; _DBG_ 564 | return false 565 | } 566 | this.debug := _debug ; _DBG_ 567 | if (this.debug) ; _DBG_ 568 | OutputDebug % "|[" A_ThisFunc "(_id:=" _id ", _debug:=" _debug ")] (version: " this.version ") -> " this.id ; _DBG_ 569 | 570 | return this 571 | } 572 | } 573 | -------------------------------------------------------------------------------- /lib/Windy/Mousy.ahk: -------------------------------------------------------------------------------- 1 | ; ****** HINT: Documentation can be extracted to HTML using NaturalDocs (http://www.naturaldocs.org/) ************** 2 | 3 | #include %A_LineFile%\.. 4 | #include Pointy.ahk 5 | #include Recty.ahk 6 | #include Mony.ahk 7 | #include MultiMony.ahk 8 | #include Const_WinUser.ahk 9 | 10 | /* ****************************************************************************************************************************************** 11 | Class: Mousy 12 | Toolset to handle mousecursor within a MultiMonitorEnvironment 13 | 14 | Authors: 15 | : Original 16 | 17 | About: License 18 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details. 19 | */ 20 | 21 | class Mousy { 22 | _version := "1.1.4" 23 | _debug := 0 ; _DBG_ 24 | _showLocatorAfterMove := 1 25 | 26 | _bConfine := false 27 | _confineRect := new Recty() 28 | _movespeed := 50 29 | _movemode := 1 30 | 31 | ; ===== Properties =============================================================== 32 | confine[] { 33 | /* ------------------------------------------------------------------------------- 34 | Property: confine [get/set] 35 | Should the mouse be confined/fenced into a rectangle? 36 | 37 | The rectangle is set via 38 | 39 | Value: 40 | flag - *true* or *false* 41 | 42 | Examples: 43 | > obj.confineRect := new Recty(100,100,500,500) 44 | > obj.confine := true ; Confining to previously defined rect is enabled 45 | > obj.confine := false ; Confining to previously defined rect is disabled 46 | > obj.confine := true ; Confining to previously defined rect is re-enabled 47 | */ 48 | get { 49 | return this._bConfine 50 | } 51 | set { 52 | OutputDebug % ">[" A_ThisFunc "()] -> New:" value " <-> Current:" this._bConfine ; _DBG_ 53 | if (value== false) { 54 | this._bConfine := false 55 | ret := DllCall( "ClipCursor" ) 56 | OutputDebug % ">" ret ; _DBG_ 57 | } 58 | else { 59 | rect := this.confineRect 60 | VarSetCapacity(R,16,0),NumPut(rect.xul,&R+0),NumPut(rect.yul,&R+4),NumPut(rect.xlr,&R+8),NumPut(rect.ylr,&R+12) 61 | this._bConfine := true 62 | DllCall("ClipCursor",UInt,&R) 63 | } 64 | return this._bConfine 65 | } 66 | } 67 | confineRect[] { 68 | /* ------------------------------------------------------------------------------- 69 | Property: confineRect [get/set] 70 | Rectangle to be considered with confine (given as ). 71 | 72 | Confining can be enabled/disabled via property 73 | 74 | Value: 75 | rect - confining rectangle 76 | 77 | See Also: 78 | 79 | */ 80 | get { 81 | return this._confineRect 82 | } 83 | set { 84 | this._confineRect.x := value.x 85 | this._confineRect.y := value.y 86 | this._confineRect.w := value.w 87 | this._confineRect.h := value.h 88 | return this._confineRect 89 | } 90 | } 91 | debug[] { ; _DBG_ 92 | /* ------------------------------------------------------------------------------- 93 | Property: debug [get/set] 94 | Debug flag for debugging the object 95 | 96 | Value: 97 | flag - *true* or *false* 98 | */ 99 | get { ; _DBG_ 100 | return this._debug ; _DBG_ 101 | } ; _DBG_ 102 | set { ; _DBG_ 103 | mode := value<1?0:1 ; _DBG_ 104 | this._debug := mode ; _DBG_ 105 | return this._debug ; _DBG_ 106 | } ; _DBG_ 107 | } 108 | monitorID[] { 109 | /* --------------------------------------------------------------------------------------- 110 | Property: monitorID [get/set] 111 | Get or Set the monitor the mouse is currently on 112 | */ 113 | get { 114 | md := new MultiMony(this._debug) 115 | return md.idFromMouse() 116 | } 117 | set { 118 | currMon := this.monitorID 119 | OutputDebug % "<[" A_ThisFunc "()] - >New:" value "<-> Current:" CurrMon ; _DBG_ 120 | if (value != currMon) { 121 | md := new MultiMony(this._debug) 122 | ; Determine relative Coordinates relative to current monitor 123 | curr := md.coordVirtualScreenToDisplay(this.x,this.y) 124 | ; Determine scaling factors from current monitor to destination monitor 125 | monCurr := new Mony(currMon, this._debug) 126 | scaleX := monCurr.scaleX(value) 127 | scaleY := monCurr.scaleY(value) 128 | mon := new Mony(value, this._debug) 129 | r := mon.boundary 130 | ; Scale the relative coordinates and add them to the origin of destination monitor 131 | x := r.x + scaleX*curr.pt.x 132 | y := r.y + scaleY*curr.pt.y 133 | ; Move the mouse onto new monitor 134 | this.__move(x, y) 135 | } 136 | return this.monitorID 137 | } 138 | } 139 | moveMode[] { 140 | /* --------------------------------------------------------------------------------------- 141 | Property: moveMode [get/set] 142 | Movement mode while moving the mouse via , , 143 | 144 | This has to be a value out of 145 | 146 | * 0: mouse jumps immediatialy to the new position 147 | * 1: mouse moves to new position following a linear track (default) 148 | * 2: mouse moves to new position following a random track jittering along a line 149 | * 3: mouse moves to new position following a random track following a bezier curce 150 | 151 | The speed of the movement can be set via 152 | */ 153 | get { 154 | return this._movemode 155 | } 156 | set { 157 | if (value < 0) 158 | value := 0 159 | if (value > 3) 160 | value := 3 161 | this._movemode := value 162 | return value 163 | } 164 | } 165 | moveSpeed[] { 166 | /* --------------------------------------------------------------------------------------- 167 | Property: moveSpeed [get/set] 168 | Speed while moving the mouse via , , 169 | 170 | This has to be a value from range [0 (instant) ..100 (slow)] 171 | */ 172 | get { 173 | return this._movespeed 174 | } 175 | set { 176 | if (value < 0) 177 | value := 0 178 | if (value > 100) 179 | value := 100 180 | this._movespeed := value 181 | return value 182 | } 183 | } 184 | pos[] { 185 | /* --------------------------------------------------------------------------------------- 186 | Property: pos [get/set] 187 | Get or Set position of mouse as a 188 | 189 | See also: 190 | , 191 | */ 192 | get { 193 | pt := new Pointy() 194 | return pt.fromMouse() 195 | } 196 | 197 | set { 198 | this.__move(value.x, value.y) 199 | return value 200 | } 201 | } 202 | showLocatorAfterMove[] { 203 | /* --------------------------------------------------------------------------------------- 204 | Property: showLocatorAfterMove [get/set] 205 | Get or Set the flag to show the Mouse-Locator after moving the mouse 206 | */ 207 | get { 208 | return this._showLocatorAfterMove 209 | } 210 | set { 211 | this._showLocatorAfterMove := value 212 | return value 213 | } 214 | } 215 | speed[] { 216 | /* --------------------------------------------------------------------------------------- 217 | Property: speed [get/set] 218 | Get or Set the speed of the mouse on (manual) mouse movement. 219 | 220 | This has to be a value from range [0..20] 221 | 222 | This value can also be set/get via System-Settings of Mouse within your windows-OS 223 | */ 224 | get { 225 | CurrMouseSpeed := 0 226 | DllCall("SystemParametersInfo", UInt, SPI.GETMOUSESPEED, UInt, 0, UIntP, CurrMouseSpeed, UInt, 0) 227 | return CurrMouseSpeed 228 | } 229 | set { 230 | if (value < 0) 231 | value := 0 232 | if (value > 20) 233 | value := 20 234 | 235 | DllCall("SystemParametersInfo", UInt, SPI.SETMOUSESPEED, UInt, 0, UInt, value, UInt, 0) 236 | return this.speed 237 | } 238 | } 239 | trail[] { 240 | /* --------------------------------------------------------------------------------------- 241 | Property: trail [get/set] 242 | Get or Set the drawing of a trail on (manual) mouse movement 243 | 244 | This has to be a value from range [0 (disabled)..7] 245 | 246 | This value can also be set/get via System-Settings of Mouse within your windows-OS 247 | */ 248 | get { 249 | nTrail := 0 250 | DllCall("SystemParametersInfo", UInt, SPI.GETMOUSETRAILS, UInt, 0, UIntP, nTrail, UInt, 0) 251 | return nTrail 252 | } 253 | set { 254 | if (value < 0) 255 | value := 0 256 | if (value > 7) 257 | value := 7 258 | 259 | DllCall("SystemParametersInfo", UInt, SPI.SETMOUSETRAILS, UInt, value, Str, 0, UInt, 0) 260 | return this.trail 261 | } 262 | } 263 | version[] { 264 | /* ------------------------------------------------------------------------------- 265 | Property: version [get] 266 | Version of the class 267 | 268 | Remarks: 269 | * There is no setter available, since this is a constant system property 270 | */ 271 | get { 272 | return this._version 273 | } 274 | } 275 | x[] { 276 | /* --------------------------------------------------------------------------------------- 277 | Property: x [get/set] 278 | Get or Set x-coordinate of mouse 279 | 280 | See also: 281 | , 282 | */ 283 | get { 284 | return this.pos.x 285 | } 286 | 287 | set { 288 | this.__move(value, this.y) 289 | return value 290 | } 291 | } 292 | y[] { 293 | /* --------------------------------------------------------------------------------------- 294 | Property: y [get/set] 295 | Get or Set y-coordinate of mouse 296 | 297 | See also: 298 | , 299 | */ 300 | get { 301 | return this.pos.y 302 | } 303 | 304 | set { 305 | this.__move(this.x, value) 306 | return value 307 | } 308 | } 309 | 310 | ; ===== Methods ================================================================== 311 | /* --------------------------------------------------------------------------------------- 312 | Method: dump 313 | Dumps coordinates to a string 314 | 315 | Returns: 316 | printable string containing coordinates 317 | */ 318 | dump() { 319 | return "(" this.x "," this.y ")" 320 | } 321 | 322 | /* --------------------------------------------------------------------------------------- 323 | Method: locate 324 | Easy find the mouse 325 | */ 326 | locate() { 327 | 328 | applicationname := A_ScriptName 329 | 330 | SetWinDelay,0 331 | DetectHiddenWindows,On 332 | CoordMode,Mouse,Screen 333 | 334 | delay := 100 335 | size1 := 250 336 | size2 := 200 337 | size3 := 150 338 | size4 := 100 339 | size5 := 50 340 | col1 := "Red" 341 | col2 := "Blue" 342 | col3 := "Yellow" 343 | col4 := "Lime" 344 | col5 := "Green" 345 | boldness1 := 700 346 | boldness2 := 600 347 | boldness3 := 500 348 | boldness4 := 400 349 | boldness5 := 300 350 | 351 | Transform, OutputVar, Chr, 177 352 | 353 | Loop,5 354 | { 355 | MouseGetPos,x,y 356 | size:=size%A_Index% 357 | width:=Round(size%A_Index%*1.4) 358 | height:=Round(size%A_Index%*1.4) 359 | colX:=col%A_Index% 360 | boldness:=boldness%A_Index% 361 | Gui,Mousy%A_Index%:New 362 | Gui,Mousy%A_Index%:+Owner +AlwaysOnTop -Resize -SysMenu -MinimizeBox -MaximizeBox -Disabled -Caption -Border -ToolWindow 363 | Gui,Mousy%A_Index%:Margin,0,0 364 | Gui,Mousy%A_Index%:Color,123456 365 | 366 | Gui,Mousy%A_Index%:Font,c%colX% S%size% W%boldness%,Wingdings 367 | Gui,Mousy%A_Index%:Add,Text,,%OutputVar% 368 | 369 | Gui,Mousy%A_Index%:Show,X-%width% Y-%height% W%width% H%height% NoActivate,%applicationname%%A_Index% 370 | WinSet,TransColor,123456,%applicationname%%A_Index% 371 | } 372 | Loop,5 373 | { 374 | MouseGetPos,x,y 375 | WinMove,%applicationname%%A_Index%,,% x-size%A_Index%/1.7,% y-size%A_Index%/1.4 376 | WinShow,%applicationname%%A_Index% 377 | Sleep,%delay% 378 | WinHide,%applicationname%%A_Index% 379 | ;Sleep,%delay% 380 | } 381 | 382 | Loop,5 383 | { 384 | Gui,Mousy%A_Index%:Destroy 385 | } 386 | } 387 | 388 | ; ===== Internal Methods ========================================================= 389 | /* --------------------------------------------------------------------------------------- 390 | Method: __move 391 | Moves the mouse to given coordinates (*INTERNAL*) 392 | 393 | Parameters: 394 | x,y - Coordinates to move to 395 | */ 396 | __move(x,y, mode = -1, speed = -1) { 397 | if (speed == -1) { 398 | speed := this._movespeed 399 | } 400 | if (mode == -1) { 401 | mode := this._movemode 402 | } 403 | T := A_MouseDelay 404 | SetMouseDelay, -1 405 | CoordMode, Mouse, Screen 406 | if (mode == 0) { 407 | MouseMove % x, y, 0 408 | } 409 | else if (mode == 1) { 410 | MouseMove % x, y, speed 411 | } 412 | else if (mode == 2) { 413 | this.__moveRandomLinear(x, y, speed) 414 | } 415 | else if (mode == 3) { 416 | this.__moveRandomBezier(x, y, speed) 417 | } 418 | if (this.showLocatorAfterMove == 1) 419 | this.locate() 420 | SetMouseDelay, % T 421 | } 422 | 423 | /* --------------------------------------------------------------------------------------- 424 | Method: __moveRandomBezier 425 | Moves the mouse to given coordinates on a random path, following a bezier curve (*INTERNAL*) 426 | 427 | Parameters: 428 | x,y - Coordinates to move to 429 | 430 | Authors: 431 | * Original: 432 | */ 433 | __moveRandomBezier(x, y, Speed=-1) { 434 | if (speed == -1) { 435 | speed := this._movespeed 436 | } 437 | 438 | time := 5000/100 * speed 439 | 440 | T := A_MouseDelay 441 | SetMouseDelay, -1 442 | MouseGetPos, CX, CY 443 | RandomBezier(CX, CY, x, y, "T" time) 444 | SetMouseDelay, % T 445 | } 446 | 447 | /* --------------------------------------------------------------------------------------- 448 | Method: __moveRandomLinear 449 | Moves the mouse to given coordinates on a random path, jittering along a line (*INTERNAL*) 450 | 451 | Parameters: 452 | x,y - Coordinates to move to 453 | 454 | Authors: 455 | * Original: 456 | */ 457 | __moveRandomLinear(x, y, Speed=-1) { 458 | if (speed == -1) { 459 | speed := this._movespeed 460 | } 461 | T := A_MouseDelay 462 | SetMouseDelay, -1 463 | MouseGetPos, CX, CY 464 | Pts := Round(Sqrt((X - CX)**2 + (Y - CY)**2) / 30,0) 465 | Loop %Pts% { 466 | Random, NX, % CX - ((CX - X) / Pts) * (A_Index - 1), % CX - ((CX - X) / Pts) * A_Index 467 | Random, NY, % CY - ((CY - Y) / Pts) * (A_Index - 1), % CY - ((CY - Y) / Pts) * A_Index 468 | MouseMove, % NX, % NY, % speed 469 | } 470 | MouseMove, % X, % Y, % Speed 471 | SetMouseDelay, % T 472 | } 473 | 474 | /* ------------------------------------------------------------------------------- 475 | Constructor: __New 476 | Constructor (*INTERNAL*) 477 | 478 | Parameters: 479 | debug - Flag to enable debugging (Optional; Default: 0) 480 | */ 481 | __New( debug := false ) { 482 | this._debug := debug ; _DBG_ 483 | if (this._debug) ; _DBG_ 484 | OutputDebug % "|[" A_ThisFunc ")] (version: " this._version ")" ; _DBG_ 485 | } 486 | } 487 | 488 | 489 | /* 490 | RandomBezier.ahk 491 | Copyright (C) 2012,2013 Antonio França 492 | This script is free software: you can redistribute it and/or modify 493 | it under the terms of the GNU Affero General Public License as 494 | published by the Free Software Foundation, either version 3 of the 495 | License, or (at your option) any later version. 496 | This script is distributed in the hope that it will be useful, 497 | but WITHOUT ANY WARRANTY; without even the implied warranty of 498 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 499 | GNU Affero General Public License for more details. 500 | You should have received a copy of the GNU Affero General Public License 501 | along with this script. If not, see . 502 | */ 503 | ;======================================================================== 504 | ; 505 | ; Function: RandomBezier 506 | ; Moves the mouse through a random Bézier path 507 | ; URL (+info): -------------------- 508 | ; 509 | ; Last Update: 30/May/2013 03:00h BRT 510 | ; 511 | ; Author: 512 | ; * Created by MasterFocus (https://github.com/MasterFocus, http://masterfocus.ahk4.net, http://autohotkey.com/community/viewtopic.php?f=2&t=88198) 513 | RandomBezier( X0, Y0, Xf, Yf, O="") { 514 | Time := RegExMatch(O,"i)T(\d+)",M)&&(M1>0)? M1: 10 515 | RO := InStr(O,"RO",0) , RD := InStr(O,"RD",0) 516 | N:=!RegExMatch(O,"i)P(\d+)(-(\d+))?",M)||(M1<2)? 2: (M1>19)? 19: M1 517 | If ((M:=(M3!="")? ((M3<2)? 2: ((M3>19)? 19: M3)): ((M1=="")? 5: ""))!="") 518 | Random, N, %N%, %M% 519 | OfT:=RegExMatch(O,"i)OT(-?\d+)",M)? M1: 100, OfB:=RegExMatch(O,"i)OB(-?\d+)",M)? M1: 100 520 | OfL:=RegExMatch(O,"i)OL(-?\d+)",M)? M1: 100, OfR:=RegExMatch(O,"i)OR(-?\d+)",M)? M1: 100 521 | MouseGetPos, XM, YM 522 | If ( RO ) 523 | X0 += XM, Y0 += YM 524 | If ( RD ) 525 | Xf += XM, Yf += YM 526 | If ( X0 < Xf ) 527 | sX := X0-OfL, bX := Xf+OfR 528 | Else 529 | sX := Xf-OfL, bX := X0+OfR 530 | If ( Y0 < Yf ) 531 | sY := Y0-OfT, bY := Yf+OfB 532 | Else 533 | sY := Yf-OfT, bY := Y0+OfB 534 | Loop, % (--N)-1 { 535 | Random, X%A_Index%, %sX%, %bX% 536 | Random, Y%A_Index%, %sY%, %bY% 537 | } 538 | X%N% := Xf, Y%N% := Yf, E := ( I := A_TickCount ) + Time 539 | While ( A_TickCount < E ) { 540 | U := 1 - (T := (A_TickCount-I)/Time) 541 | Loop, % N + 1 + (X := Y := 0) { 542 | Loop, % Idx := A_Index - (F1 := F2 := F3 := 1) 543 | F2 *= A_Index, F1 *= A_Index 544 | Loop, % D := N-Idx 545 | F3 *= A_Index, F1 *= A_Index+Idx 546 | M:=(F1/(F2*F3))*((T+0.000001)**Idx)*((U-0.000001)**D), X+=M*X%Idx%, Y+=M*Y%Idx% 547 | } 548 | MouseMove, %X%, %Y%, 0 549 | Sleep, 1 550 | } 551 | MouseMove, X%N%, Y%N%, 0 552 | Return N+1 553 | } -------------------------------------------------------------------------------- /lib/Windy/MultiMony.ahk: -------------------------------------------------------------------------------- 1 | ; ****** HINT: Documentation can be extracted to HTML using NaturalDocs (http://www.naturaldocs.org/) ************** 2 | 3 | ; ****** HINT: Debug-lines should contain "; _DBG_" at the end of lines - using this, the debug lines could be automatically removed through scripts before releasing the sourcecode 4 | 5 | #include %A_LineFile%\.. 6 | #include Recty.ahk 7 | #include Pointy.ahk 8 | #include Mony.ahk 9 | 10 | /* ****************************************************************************************************************************************** 11 | Class: MultiMony 12 | Handling Multiple Display-Monitor Environments 13 | 14 | Authors: 15 | : Original 16 | 17 | About: License 18 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details. 19 | */ 20 | class MultiMony { 21 | _debug := 0 22 | _version := "1.0.2" 23 | 24 | ; ===== Properties ============================================================== 25 | debug[] { 26 | /* ------------------------------------------------------------------------------- 27 | Property: debug [get/set] 28 | Debug flag for debugging the object 29 | 30 | Value: 31 | flag - *true* or *false* 32 | */ 33 | get { 34 | return this._debug 35 | } 36 | set { 37 | mode := value<1?0:1 38 | this._debug := mode 39 | return this._debug 40 | } 41 | } 42 | idPrimary[] { 43 | /* --------------------------------------------------------------------------------------- 44 | Property: idPrimary [get] 45 | Get the ID of the primary monitor 46 | 47 | Remarks: 48 | * There is no setter available, since this is a constant system property 49 | */ 50 | get { 51 | SysGet, ret, MonitorPrimary 52 | if (this._debug) ; _DBG_ 53 | OutputDebug % "|[" A_ThisFunc "([" this.id "]) -> (" ret ")]" ; _DBG_ 54 | return ret 55 | } 56 | } 57 | idTaskbar[] { 58 | /* --------------------------------------------------------------------------------------- 59 | Property: idTaskbar [get] 60 | Get the ID of the monitor where the taskbar is on (aka. primary monitor) 61 | 62 | Remarks: 63 | * There is no setter available, since this is a constant system property 64 | */ 65 | get { 66 | return this.idPrimary 67 | } 68 | } 69 | monitorsCount[] { 70 | /* --------------------------------------------------------------------------------------- 71 | Property: monitorsCount [get] 72 | Number of available monitors. 73 | 74 | Remarks: 75 | * There is no setter available, since this is a constant system property 76 | */ 77 | get { 78 | CoordMode, Mouse, Screen 79 | SysGet, mCnt, MonitorCount 80 | if (this._debug) ; _DBG_ 81 | OutputDebug % "|[" A_ThisFunc "()) -> (" mCnt ")]" ; _DBG_ 82 | return mCnt 83 | } 84 | } 85 | size[] { 86 | /* --------------------------------------------------------------------------------------- 87 | Property: size [get] 88 | Get the size of virtual screen in Pixel as a . 89 | 90 | The virtual screen is the bounding rectangle of all display monitors 91 | 92 | Remarks: 93 | * There is no setter available, since this is a constant system property 94 | 95 | See Also: 96 | 97 | */ 98 | get { 99 | rect := this.virtualScreenSize 100 | if (this._debug) ; _DBG_ 101 | OutputDebug % "<[" A_ThisFunc "()] -> (" rect.dump() ")" ; _DBG_ 102 | return rect 103 | } 104 | } 105 | version[] { 106 | /* ------------------------------------------------------------------------------- 107 | Property: version [get] 108 | Version of the class 109 | 110 | Remarks: 111 | * There is no setter available, since this is a constant system property 112 | */ 113 | get { 114 | return this._version 115 | } 116 | } 117 | virtualScreenSize[] { 118 | /* --------------------------------------------------------------------------------------- 119 | Property: virtualScreenSize [get] 120 | Get the size of virtual screen in Pixel as a . 121 | 122 | The virtual screen is the bounding rectangle of all display monitors 123 | 124 | Remarks: 125 | * There is no setter available, since this is a constant system property 126 | 127 | See Also: 128 | 129 | */ 130 | get { 131 | SysGet, x, 76 132 | SysGet, y, 77 133 | SysGet, w, 78 134 | SysGet, h, 79 135 | rect := new Recty(x,y,w,h, this._debug) 136 | if (this._debug) ; _DBG_ 137 | OutputDebug % "<[" A_ThisFunc "()] -> (" rect.dump() ")" ; _DBG_ 138 | return rect 139 | } 140 | } 141 | 142 | ; ===== Methods ================================================================== 143 | 144 | /* ------------------------------------------------------------------------------- 145 | Method: coordDisplayToVirtualScreen 146 | Transforms coordinates relative to given monitor into absolute (virtual) coordinates. Returns object of type 147 | 148 | Parameters: 149 | id - id of the monitor 150 | x,y - relative coordinates on given monitor 151 | 152 | Returns: 153 | . 154 | */ 155 | coordDisplayToVirtualScreen( id := 1, x := 0, y := 0) { 156 | oMon := new Mony(id, this._debug) 157 | r := oMon.boundary() 158 | xout := x + r.x 159 | yout := y + r.y 160 | pt := new Pointy(xout, yout ,this._debug) 161 | if (this._debug) ; _DBG_ 162 | OutputDebug % "|[" A_ThisFunc "(id:=" id ", x:=" x ", y:=" y ")] -> (" pt.dump() ")" ; _DBG_ 163 | return pt 164 | } 165 | /* ------------------------------------------------------------------------------- 166 | Method: coordVirtualScreenToDisplay 167 | Transforms absolute coordinates from Virtual Screen into coordinates relative to screen. 168 | 169 | Parameters: 170 | x,y - absolute coordinates 171 | 172 | Returns: 173 | Object containing relative coordinates and monitorID 174 | */ 175 | coordVirtualScreenToDisplay(x,y) { 176 | ret := Object() 177 | ret.monID := this.idFromCoord(x,y) 178 | 179 | oMon := new Mony(ret.monId, this._debug) 180 | r := oMon.boundary 181 | xret := x - r.x 182 | yret := y - r.y 183 | pt := new Pointy(xret, yret, this._debug) 184 | ret.pt := pt 185 | if (this._debug) ; _DBG_ 186 | OutputDebug % "|[" A_ThisFunc "( x:=" x ", y:=" y ")] -> ( " ret.monId ",(" ret.pt.dump() "))" ; _DBG_ 187 | return ret 188 | } 189 | /* ------------------------------------------------------------------------------- 190 | Method: hmonFromCoord 191 | Get the handle of the monitor containing the specified x and y coordinates. 192 | 193 | Parameters: 194 | x,y - Coordinates 195 | 196 | Returns: 197 | Handle of the monitor at specified coordinates 198 | 199 | Authors: 200 | * Original: 201 | 202 | See Also: 203 | 204 | */ 205 | hmonFromCoord(x := "", y := "") { 206 | VarSetCapacity(PT, 8, 0) 207 | If (X = "") || (Y = "") { 208 | DllCall("User32.dll\GetCursorPos", "Ptr", &PT) 209 | If (X = "") 210 | X := NumGet(PT, 0, "Int") 211 | If (Y = "") 212 | Y := NumGet(PT, 4, "Int") 213 | } 214 | hmon := DllCall("User32.dll\MonitorFromPoint", "Int64", (X & 0xFFFFFFFF) | (Y << 32), "UInt", 0, "UPtr") 215 | if (this._debug) ; _DBG_ 216 | OutputDebug % "|[" A_ThisFunc "(x:=" x ", y:=" y ")] -> " hmon ; _DBG_ 217 | 218 | return hmon 219 | } 220 | /* ------------------------------------------------------------------------------- 221 | Method: hmonFromHwnd 222 | Get the handle of the monitor containing the swindow with given window handle. 223 | 224 | Parameters: 225 | hwnd - Window Handle 226 | 227 | Returns: 228 | Handle of the monitor containing the specified window 229 | 230 | Authors: 231 | * Original: 232 | 233 | See Also: 234 | 235 | */ 236 | hmonFromHwnd(hwnd) { 237 | hmon := DllCall("User32.dll\MonitorFromWindow", "Ptr", HWND, "UInt", 0, "UPtr") 238 | if (this._debug) ; _DBG_ 239 | OutputDebug % "|[" A_ThisFunc "(hwnd:=" hwnd ")] -> " hmon ; _DBG_ 240 | return hmon 241 | } 242 | /* ------------------------------------------------------------------------------- 243 | Method: hmonFromId 244 | Get the handle of the monitor from monitor id. 245 | 246 | Parameters: 247 | id - Monitor ID 248 | 249 | Returns: 250 | Monitor Handle 251 | 252 | See Also: 253 | 254 | */ 255 | hmonFromid(id := 1) { 256 | oMon := new Mony(id, this._debug) 257 | hmon := oMon.hmon 258 | if (this._debug) ; _DBG_ 259 | OutputDebug % "|[" A_ThisFunc "(id:=" id ")] -> " hmon ; _DBG_ 260 | return hmon 261 | } 262 | /* ------------------------------------------------------------------------------- 263 | Method: hmonFromRect 264 | Get the handle of the monitor that has the largest area of intersection with a specified rectangle. 265 | 266 | Parameters: 267 | x,y, w,h - rectangle 268 | 269 | Returns: 270 | Monitor Handle 271 | 272 | Authors: 273 | * Original: 274 | 275 | See Also: 276 | 277 | */ 278 | hmonFromRect(x, y, w, h) { 279 | VarSetCapacity(RC, 16, 0) 280 | NumPut(x, RC, 0, "Int") 281 | NumPut(y, RC, 4, "Int") 282 | NumPut(x + w, RC, 8, "Int") 283 | NumPut(y + h, RC, 12, "Int") 284 | hmon := DllCall("User32.dll\MonitorFromRect", "Ptr", &RC, "UInt", 0, "UPtr") 285 | if (this._debug) ; _DBG_ 286 | OutputDebug % "|[" A_ThisFunc "(x:=" x ", y:=" y ",w:=" w ", h:=" h ")] -> " hmon ; _DBG_ 287 | return hmon 288 | } 289 | /* ------------------------------------------------------------------------------- 290 | method: identify 291 | Identify monitors by displaying the monitor id on each monitor 292 | 293 | Parameters: 294 | disptime - time to display the monitor id (*Optional*, Default: 1500[ms]) 295 | txtcolor - color of the displayed monitor id (*Optional*, Default: "000000") 296 | txtsize - size of the displayed monitor id (*Optional*, Default: 300[px]) 297 | */ 298 | identify(disptime := 1500, txtcolor := "000000", txtsize := 300) { 299 | 300 | if (this._debug) ; _DBG_ 301 | OutputDebug % ">[" A_ThisFunc "(disptime := " disptime ", txtcolor := " txtcolor ", txtsize := " txtsize ")]" ; _DBG_ 302 | 303 | monCnt := this.monitorsCount 304 | Loop %monCnt% 305 | { 306 | mon := new Mony(A_Index, this._debug) 307 | mon.__idShow(txtcolor, txtsize) 308 | } 309 | Sleep, %disptime% 310 | Loop %monCnt% { 311 | mon := new Mony(A_Index, this._debug) 312 | mon.__idHide() 313 | } 314 | 315 | if (this._debug) ; _DBG_ 316 | OutputDebug % "<[" A_ThisFunc "(disptime := " disptime ", txtcolor := " txtcolor ", txtsize := " txtsize ")]" ; _DBG_ 317 | 318 | return 319 | } 320 | /* ------------------------------------------------------------------------------- 321 | Method: idFromCoord 322 | Get the index of the monitor containing the specified x and y coordinates. 323 | 324 | Parameters: 325 | x,y - Coordinates 326 | default - Default monitor 327 | 328 | Returns: 329 | Index of the monitor at specified coordinates 330 | 331 | See Also: 332 | 333 | */ 334 | idFromCoord(x, y, default := 1) { 335 | m := this.monitorsCount 336 | mon := default 337 | ; Iterate through all monitors. 338 | Loop, %m% 339 | { 340 | oMon := new Mony(A_Index, this._debug) 341 | rect := oMon.boundary 342 | if (x >= rect.x && x <= rect.w && y >= rect.y && y <= rect.h) 343 | mon := A_Index 344 | } 345 | if (this._debug) ; _DBG_ 346 | OutputDebug % "|[" A_ThisFunc "(x=" x ",y=" y ")] -> " mon ; _DBG_ 347 | return mon 348 | } 349 | /* ------------------------------------------------------------------------------- 350 | Method: idFromHwnd 351 | Get the ID of the monitor containing the swindow with given window handle. 352 | 353 | Parameters: 354 | hwnd - Window Handle 355 | 356 | Returns: 357 | ID of the monitor containing the specified window 358 | 359 | See Also: 360 | 361 | */ 362 | idFromHwnd(hwnd) { 363 | hmon := this.hmonFromHwnd(hwnd) 364 | id := this.idFromHmon(hmon) 365 | if (this._debug) ; _DBG_ 366 | OutputDebug % "|[" A_ThisFunc "(hwnd:=" hwnd ")] -> " id ; _DBG_ 367 | return id 368 | } 369 | /* ------------------------------------------------------------------------------- 370 | Method: idFromMouse 371 | Get the index of the monitor where the mouse is 372 | 373 | Parameters: 374 | default - Default monitor 375 | 376 | Returns: 377 | Index of the monitor where the mouse is 378 | */ 379 | idFromMouse(default:=1) { 380 | CoordMode, Mouse, Screen 381 | MouseGetPos,x,y 382 | mon := this.idFromCoord(x,y,default) 383 | if (this._debug) ; _DBG_ 384 | OutputDebug % "|[" A_ThisFunc "()] (" x "," y ")-> " mon ; _DBG_ 385 | return mon 386 | } 387 | /* ------------------------------------------------------------------------------- 388 | Method: idFromHmon 389 | Get the index of the monitor from monitor handle 390 | 391 | Parameters: 392 | hmon - monitor handle 393 | 394 | Returns: 395 | Index of the monitor 396 | 397 | See Also: 398 | 399 | */ 400 | idFromHmon(hmon) { 401 | MonNum := 0 402 | NumPut(VarSetCapacity(MIEX, 40 + (32 << !!A_IsUnicode)), MIEX, 0, "UInt") 403 | If DllCall("User32.dll\GetMonitorInfo", "Ptr", hmon, "Ptr", &MIEX) { 404 | MonName := StrGet(&MIEX + 40, 32) ; CCHDEVICENAME = 32 405 | MonNum := RegExReplace(MonName, ".*(\d+)$", "$1") 406 | } 407 | return MonNum 408 | } 409 | /* ------------------------------------------------------------------------------- 410 | Method: idFromRect 411 | Get the ID of the monitor that has the largest area of intersection with a specified rectangle. 412 | 413 | Parameters: 414 | x,y, w,h - rectangle 415 | 416 | Returns: 417 | Monitor Handle 418 | 419 | See Also: 420 | 421 | */ 422 | idFromRect(x, y, w, h) { 423 | hmon := this.hmonFromRect(x,y,w,h) 424 | id := this.idFromHmon(hmon) 425 | if (this._debug) ; _DBG_ 426 | OutputDebug % "|[" A_ThisFunc "(x:=" x ", y:=" y ",w:=" w ", h:=" h ")] -> " id ; _DBG_ 427 | return id 428 | } 429 | /* ------------------------------------------------------------------------------- 430 | Method: idNext 431 | Gets the id of the next monitor. 432 | 433 | Parameters: 434 | id - monitor, whose next monitorid has to be determined 435 | cycle - *== 1* cycle through monitors; *== 0* stop at last monitor (*Optional*, Default: 1) 436 | 437 | See Also: 438 | 439 | */ 440 | idNext( currMon := 1, cycle := true ) { 441 | nextMon := currMon + 1 442 | if (cycle == false) { 443 | if (nextMon > this.monitorsCount) { 444 | nextMon := this.monitorsCount 445 | } 446 | } 447 | else { 448 | if (nextMon > this.monitorsCount) { 449 | nextMon := Mod(nextMon, this.monitorsCount) 450 | } 451 | } 452 | if (this._debug) ; _DBG_ 453 | OutputDebug % "|[" A_ThisFunc "(currMon=" currMon ", cycle=" cycle ")] -> " nextMon ; _DBG_ 454 | 455 | return nextMon 456 | } 457 | /* ------------------------------------------------------------------------------- 458 | Method: idPrev 459 | Gets the id of the previous monitor 460 | 461 | Parameters: 462 | id - monitor, whose previous monitor id has to be determined 463 | cycle - *== true* cycle through monitors; *== false* stop at first monitor (*Optional*, Default: true) 464 | 465 | See Also: 466 | 467 | */ 468 | idPrev( currMon := 1, cycle := true ) { 469 | prevMon := currMon - 1 470 | if (cycle == false) { 471 | if (prevMon < 1) { 472 | prevMon := 1 473 | } 474 | } 475 | else { 476 | if (prevMon < 1) { 477 | prevMon := this.monitorsCount 478 | } 479 | } 480 | if (this._debug) ; _DBG_ 481 | OutputDebug % "|[" A_ThisFunc "(currMon=" currMon ", cycle=" cycle ")] -> " prevMon ; _DBG_ 482 | 483 | return prevMon 484 | } 485 | /* ------------------------------------------------------------------------------- 486 | Method: monitors 487 | Enumerates display monitors and returns an object all monitors (list of object ) 488 | 489 | Returns: 490 | monitors - associative array with monitor id as key and objects as values 491 | */ 492 | monitors() { 493 | Monis := {} 494 | mc := this.monitorsCount 495 | id := 1 496 | while ( id <= mc) { 497 | Monis[id] :=new Mony(id) 498 | id++ 499 | } 500 | if (this._debug) ; _DBG_ 501 | OutputDebug % "|[" A_ThisFunc "()] -> " Monis.MaxIndex() " Monitors" ; _DBG_ 502 | Return Monis 503 | } 504 | ; ====== Internal Methods ========================================================= 505 | /* ------------------------------------------------------------------------------- 506 | Function: __New 507 | Constructor (*INTERNAL*) 508 | 509 | Parameters: 510 | _debug - Flag to enable debugging (Optional - Default: 0) 511 | */ 512 | __New(_debug=false) { 513 | this._debug := _debug ; _DBG_ 514 | if (this._debug) ; _DBG_ 515 | OutputDebug % "|[" A_ThisFunc "(_debug=" _debug ")] (version: " this._version ")" ; _DBG_ 516 | 517 | return this 518 | } 519 | } 520 | 521 | -------------------------------------------------------------------------------- /lib/Windy/Pointy.ahk: -------------------------------------------------------------------------------- 1 | ; ****** HINT: Documentation can be extracted to HTML using NaturalDocs (http://www.naturaldocs.org/) ************** 2 | 3 | ; ****** HINT: Debug-lines should contain "; _DBG_" at the end of lines - using this, the debug lines could be automatically removed through scripts before releasing the sourcecode 4 | 5 | class Pointy { 6 | ; ****************************************************************************************************************************************** 7 | /* 8 | Class: Pointy 9 | Handling points (given through 2-D coordinates [x, y]) 10 | 11 | Authors: 12 | : Original 13 | 14 | About: License 15 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details. 16 | */ 17 | 18 | _version := "0.2.0" 19 | _debug := 0 ; _DBG_ 20 | x := 0 21 | y := 0 22 | 23 | ; ##################### Start of Properties (AHK >1.1.16.x) ############################################################ 24 | debug[] { 25 | /* ------------------------------------------------------------------------------- 26 | Property: debug [get/set] 27 | Debug flag for debugging the object 28 | 29 | Value: 30 | flag - *true* or *false* 31 | */ 32 | get { 33 | return this._debug 34 | } 35 | set { 36 | mode := value<1?0:1 37 | this._debug := mode 38 | return this._debug 39 | } 40 | } 41 | ; ##################### End of Properties (AHK >1.1.16.x) ############################################################## 42 | 43 | /* -------------------------------------------------------------------------------------- 44 | Method: Dump() 45 | Dumps coordinates to a string 46 | 47 | Returns: 48 | printable string containing coordinates 49 | */ 50 | Dump() { 51 | return "(" this.x "," this.y ")" 52 | } 53 | /* -------------------------------------------------------------------------------------- 54 | Method: equal(comp) 55 | Compares currrent point to given point 56 | 57 | Parameters: 58 | comp - [Point](Pointy.html) to compare with 59 | 60 | Returns: 61 | true or false 62 | */ 63 | equal(comp) { 64 | 65 | return (this.x == comp.x) AND (this.y == comp.y) 66 | } 67 | /* -------------------------------------------------------------------------------------- 68 | Method: fromHWnd(hwnd) 69 | Fills values with upper left corner coordinates from given Window (given by Handle) 70 | 71 | Parameters: 72 | hWnd - Window handle, whose upper left corner has to be determined 73 | */ 74 | fromHWnd(hwnd) { 75 | WinGetPos, x, y, w, h, ahk_id %hwnd% 76 | this.x := x 77 | this.y := y 78 | if (this._debug) ; _DBG_ 79 | OutputDebug % "|[" A_ThisFunc "([" hwnd "])] -> x,y: (" x "," y ")" ; _DBG_ 80 | 81 | return this 82 | } 83 | /* -------------------------------------------------------------------------------------- 84 | Method: fromMouse(hwnd) 85 | Fills values from current mouseposition 86 | */ 87 | fromMouse() { 88 | CoordMode, Mouse, Screen 89 | MouseGetPos, x, y 90 | this.x := x 91 | this.y := y 92 | if (this._debug) ; _DBG_ 93 | OutputDebug % "|[" A_ThisFunc "([" hwnd "])] -> x,y: (" x "," y ")" ; _DBG_ 94 | 95 | return this 96 | } 97 | /* -------------------------------------------------------------------------------------- 98 | Method: fromPoint(new) 99 | Fills values from given 100 | 101 | Parameters: 102 | new - Point 103 | */ 104 | fromPoint(new) { 105 | this.x := new.x 106 | this.y := new.y 107 | if (this._debug) ; _DBG_ 108 | OutputDebug % "|[" A_ThisFunc "] -> x,y: " this.Dump() ; _DBG_ 109 | 110 | return this 111 | } 112 | /* --------------------------------------------------------------------------------------- 113 | Constructor: __New 114 | Constructor via given X,X Coordinates 115 | 116 | Parameters: 117 | x,y - X,Y coordinates of the point 118 | debug - Flag to enable debugging (Optional - Default: 0) 119 | */ 120 | __New(x=0, y=0, debug=false) { 121 | this._debug := debug ; _DBG_ 122 | if (this._debug) ; _DBG_ 123 | OutputDebug % "|[" A_ThisFunc "(x=" x ", y=" y ", _debug=" debug ")] (version: " this._version ")" ; _DBG_ 124 | this.x := x 125 | this.y := y 126 | } 127 | } 128 | 129 | /*! 130 | End of class 131 | */ 132 | -------------------------------------------------------------------------------- /lib/Windy/Recty.ahk: -------------------------------------------------------------------------------- 1 | #include %A_LineFile%\.. 2 | #include ..\DbgOut.ahk 3 | 4 | ; ****** HINT: Documentation can be extracted to HTML using NaturalDocs (http://www.naturaldocs.org/) ************** 5 | 6 | class Recty { 7 | ; ****************************************************************************************************************************************** 8 | /* 9 | Class: Recty 10 | Handling rectangles (given through [x, y (upper-left corner), w, h] or [x, y (upper-left corner), x, y (lower-right corner)]) 11 | 12 | Authors: 13 | : Original 14 | 15 | About: License 16 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details. 17 | 18 | */ 19 | _version := "0.3.1" 20 | _debug := 0 ; _DBG_ 21 | x := 0 22 | y := 0 23 | w := 0 24 | h := 0 25 | 26 | ; ##################### Start of Properties (AHK >1.1.16.x) ############################################################ 27 | debug[] { 28 | /* ------------------------------------------------------------------------------- 29 | Property: debug [get/set] 30 | Debug flag for debugging the object 31 | 32 | Value: 33 | flag - *true* or *false* 34 | */ 35 | get { 36 | return this._debug 37 | } 38 | set { 39 | mode := value<1?0:1 40 | this._debug := mode 41 | return this._debug 42 | } 43 | } 44 | /* --------------------------------------------------------------------------------------- 45 | Property: x [get/set] 46 | Get or Set x-coordinate of the upper left corner of the rectangle 47 | 48 | Value: 49 | x - x-coordinate of the upper left corner of the rectangle 50 | 51 | See Also: 52 | 53 | */ 54 | /* --------------------------------------------------------------------------------------- 55 | Property: y [get/set] 56 | Get or Set y-coordinate of the upper left corner of the rectangle 57 | 58 | Value: 59 | y - y-coordinate of the upper left corner of the rectangle 60 | 61 | See Also: 62 | 63 | */ 64 | /* --------------------------------------------------------------------------------------- 65 | Property: w [get/set] 66 | Get or Set the width of the rectangle 67 | 68 | Value: 69 | w - width of the rectangle 70 | */ 71 | /* --------------------------------------------------------------------------------------- 72 | Property: h [get/set] 73 | Get or Set the height of the rectangle 74 | 75 | Value: 76 | h - height of the rectangle 77 | */ 78 | xul[] { 79 | /* ------------------------------------------------------------------------------- 80 | Property: xul [get/set] 81 | Get or Set x-coordinate of the upper left corner of the rectangle 82 | 83 | Value: 84 | xul - x-coordinate of the upper left corner of the rectangle 85 | 86 | See Also: 87 | 88 | */ 89 | get { 90 | return this.x 91 | } 92 | set { 93 | this.x := value 94 | return this.x 95 | } 96 | } 97 | yul[] { 98 | /* ------------------------------------------------------------------------------- 99 | Property: yul [get/set] 100 | Get or Set y-coordinate of the upper left corner of the rectangle 101 | 102 | Value: 103 | y - y-coordinate of the upper left corner of the rectangle 104 | 105 | See Also: 106 | 107 | */ 108 | get { 109 | return this.y 110 | } 111 | set { 112 | this.y := value 113 | return this.y 114 | } 115 | } 116 | xlr[] { 117 | /* ------------------------------------------------------------------------------- 118 | Property: xlr [get/set] 119 | Get or Set x-coordinate of the lower right corner of the rectangle 120 | 121 | Value: 122 | xlr - x-coordinate of the lower right corner of the rectangle 123 | */ 124 | get { 125 | return this.x+this.w 126 | } 127 | set { 128 | this.w := value - this.x 129 | return value 130 | } 131 | } 132 | ylr[] { 133 | /* ------------------------------------------------------------------------------- 134 | Property: ylr [get/set] 135 | Get or Set y-coordinate of the lower right corner of the rectangle 136 | 137 | Value: 138 | ylr - y-coordinate of the lower right corner of the rectangle 139 | */ 140 | get { 141 | return this.y+this.h 142 | } 143 | set { 144 | this.h := value - this.y 145 | return value 146 | } 147 | } 148 | ; ##################### End of Properties (AHK >1.1.16.x) ############################################################## 149 | 150 | /* --------------------------------------------------------------------------------------- 151 | Method: Dump 152 | Dumps coordinates to a string 153 | 154 | Returns: 155 | printable string containing coordinates 156 | */ 157 | Dump() { 158 | return "(" this.x "," this.y "," this.w "," this.h ")" 159 | } 160 | /* --------------------------------------------------------------------------------------- 161 | Method: equal 162 | Compares currrent rectangle to given rectangle 163 | 164 | Parameters: 165 | comp - to compare with 166 | 167 | Returns: 168 | true or false 169 | 170 | See Also: 171 | , 172 | */ 173 | equal(comp) { 174 | return this.equalPos(comp) AND this.equalSize(comp) 175 | } 176 | /* --------------------------------------------------------------------------------------- 177 | Method: equalPos 178 | Compares currrent rectangle position to given rectangle position 179 | 180 | Parameters: 181 | comp - to compare with 182 | 183 | Returns: 184 | true or false 185 | 186 | See Also: 187 | , 188 | */ 189 | equalPos(comp) { 190 | return (this.x == comp.x) AND (this.y == comp.y) 191 | } 192 | /* --------------------------------------------------------------------------------------- 193 | Method: equalSize 194 | Compares currrent rectangle size to given rectangle size 195 | 196 | Parameters: 197 | comp - to compare with 198 | 199 | Returns: 200 | true or false 201 | 202 | See Also: 203 | , 204 | */ 205 | equalSize(comp) { 206 | ret := (this.w == comp.w) AND (this.h == comp.h) 207 | return ret 208 | } 209 | /* --------------------------------------------------------------------------------------- 210 | Method: fromHWnd(hwnd) 211 | Fills values from given Window (given by Handle) 212 | 213 | Parameters: 214 | hWnd - Window handle, whose geometry has to be determined 215 | 216 | See Also: 217 | 218 | */ 219 | fromHWnd(hwnd) { 220 | WinGetPos, x, y, w, h, ahk_id %hwnd% 221 | this.x := x 222 | this.y := y 223 | this.w := w 224 | this.h := h 225 | dbgOut("=[" A_ThisFunc "([" hwnd "])] -> x,y,w,h: (" x "," y "," w "," h ")", this.debug) 226 | } 227 | /* --------------------------------------------------------------------------------------- 228 | Method: fromRectangle(new) 229 | Fills values from given 230 | 231 | Parameters: 232 | new - 233 | */ 234 | fromRectangle(new) { 235 | this.x := new.x 236 | this.y := new.y 237 | this.w := new.w 238 | this.h := new.h 239 | dbgOut("=[" A_ThisFunc "] -> x,y,w,h: " this.Dump(), this.debug) 240 | } 241 | /* --------------------------------------------------------------------------------------- 242 | Method: __New 243 | Constructor (*INTERNAL*) 244 | 245 | Parameters: 246 | x,y,w,h - X,Y (upper left corner coordinates) and Width, Height of the rectangle 247 | debug - Flag to enable debugging (*Optional* - Default: false) 248 | */ 249 | __New(x=0, y=0, w=0, h=0, debug=false) { 250 | this._debug := debug ; _DBG_ 251 | dbgOut("=[" A_ThisFunc "(x=" x ", y=" y ", w=" w ", h=" h ", _debug=" debug ")] (version: " this._version ")", this._debug) 252 | this.x := x 253 | this.y := y 254 | this.w := w 255 | this.h := h 256 | } 257 | } 258 | 259 | /*! 260 | End of class 261 | */ 262 | -------------------------------------------------------------------------------- /lib/Windy/WindLy.ahk: -------------------------------------------------------------------------------- 1 | ; ****** HINT: Documentation can be extracted to HTML using NaturalDocs (http://www.naturaldocs.org/) ************** 2 | 3 | ; ****** HINT: Debug-lines should contain "; _DBG_" at the end of lines - using this, the debug lines could be automatically deleted through scripts before releasing the sourcecode 4 | #include %A_LineFile%\.. 5 | #include Windy.ahk 6 | #include Const_WinUser.ahk 7 | #include ..\DbgOut.ahk 8 | 9 | 10 | /* ****************************************************************************************************************************************** 11 | Class: WindLy 12 | Class holding lists of Objects 13 | 14 | Authors: 15 | : Original 16 | 17 | About: License 18 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details. 19 | */ 20 | class WindLy { 21 | _debug := 0 22 | _version := "0.0.9" 23 | _wl := {} 24 | 25 | ; ##################### Properties (AHK >1.1.16.x) ################################################################# 26 | list[] { 27 | /* --------------------------------------------------------------------------------------- 28 | Property: list [get] 29 | Get the currently stored list (may be determined anytime) 30 | */ 31 | get { 32 | return this._wl 33 | } 34 | 35 | set { 36 | this._wl := {} 37 | this._wl := value 38 | return this.list 39 | } 40 | } 41 | ; ######################## Methods to be called directly ########################################################### 42 | /* ------------------------------------------------------------------------------- 43 | Method: byMonitorId 44 | Initializes the window list from a given monitor 45 | 46 | Parameters: 47 | id - Monitor-Id 48 | 49 | Returns: 50 | List of Objects on the given monitor 51 | */ 52 | byMonitorId(id=1) { 53 | this.__reset() 54 | _tmp := this.__all() 55 | for h_Wnd, win in _tmp { 56 | h_WndHex := this.__hexStr(h_Wnd) 57 | if (win.monitorID = id ) { 58 | this._wl[h_WndHex] := win 59 | } 60 | } 61 | _tmp := {} 62 | return this._wl 63 | } 64 | /* ------------------------------------------------------------------------------- 65 | Method: byStyle 66 | Initializes the window list by given window style 67 | 68 | Parameters: 69 | myStyle - Windows-Style () 70 | 71 | Returns: 72 | List of Objects matching the given style 73 | */ 74 | byStyle(myStyle) { 75 | this.__reset() 76 | _tmp := this.__all() 77 | 78 | for h_Wnd, win in _tmp { 79 | WinGet, l_tmp, Style, ahk_id %h_Wnd% 80 | h_WndHex := this.__hexStr(h_Wnd) 81 | if (l_tmp & myStyle) { 82 | this.Insert(win) 83 | } 84 | } 85 | _tmp := {} 86 | return this._wl 87 | } 88 | /* ------------------------------------------------------------------------------- 89 | Method: delete 90 | deletes a single Windy-object from current instance 91 | 92 | Parameters: 93 | oWindy - Object to be deleted 94 | */ 95 | delete(oWindy) { 96 | x := this.__decStr(oWindy._hwnd) 97 | if (this._wl[this.__decStr(oWindy._hwnd)]) { 98 | this._wl.Delete(this.__decStr(oWindy._hwnd)) 99 | } 100 | return this.list 101 | } 102 | /* ------------------------------------------------------------------------------- 103 | Method: difference 104 | Calculates the DIFFERENCE of the current instance and the given WindLy-Object 105 | 106 | The difference contains only elements from the current instance which are not part of the given WindLy-object 107 | 108 | Parameters: 109 | oWindLy - Object to be used for calculating difference 110 | */ 111 | difference(oWindLy) { 112 | for currhwnd, data in oWindLy.list { 113 | this.delete(data) 114 | } 115 | return this.list 116 | } 117 | /* ------------------------------------------------------------------------------- 118 | Method: insert 119 | Inserts a single Windy-object into current instance 120 | 121 | Parameters: 122 | oWindy - Object to be inserted 123 | */ 124 | insert(oWindy) { 125 | if (!this._wl[oWindy._hwnd]) { 126 | h_WndHex := this.__hexStr(oWindy._hwnd) 127 | this._wl[h_WndHex] := oWindy 128 | } 129 | } 130 | /* ------------------------------------------------------------------------------- 131 | Method: intersection 132 | Calculates the INTERSECTION of the given WindLy-Object and the current instance 133 | 134 | The result only contains Objects which 135 | have been in the current instance as well as in the given WindLy-Object 136 | 137 | Parameters: 138 | oWindy - Object to be inserted 139 | */ 140 | intersection(oWindLy) { 141 | result := new WindLy(this.debug) 142 | for _currhwnd, _data in oWindLy.list { 143 | if (this._wl[_data.hwnd]) { 144 | result.insert(_data) 145 | } 146 | } 147 | this.list := result.list 148 | return result.list 149 | } 150 | /* ------------------------------------------------------------------------------- 151 | Method: removeNonExisting 152 | Remove non-existing windows from the list 153 | 154 | The result only contains Objects which 155 | do currently exist. Non existing windows are removed from the list. 156 | */ 157 | removeNonExisting() { 158 | dbgOut(">[" A_ThisFunc "([" this.hwnd "])]", this.debug) 159 | u := new WindLy(this.debug) 160 | u.list := this.list.Clone() 161 | for key, data in u.list { 162 | OutputDebug % " CURRENT:" key ": " data.hwnd ": " data.title " (" key ")" 163 | if !data.exist { 164 | dbgOut("|[" A_ThisFunc "([" this.hwnd "])] - REMOVE SINCE NON EXISTANT:" key ": " data.hwnd, this.debug) 165 | u.delete(data) 166 | } 167 | } 168 | this.list := u.list.Clone() 169 | dbgOut("<[" A_ThisFunc "([" this.hwnd "])]", this.debug) 170 | return this.list 171 | } 172 | /* ------------------------------------------------------------------------------- 173 | Method: snapshot 174 | Initializes the window list from all currently openend windows 175 | 176 | Returns: 177 | List of Objects. 178 | */ 179 | snapshot() { 180 | dbgOut(">[" A_ThisFunc "()]", this.debug) 181 | this.__reset() 182 | this._wl := this.__all() 183 | dbgOut("<[" A_ThisFunc "()]", this.debug) 184 | return this._wl 185 | } 186 | /* ------------------------------------------------------------------------------- 187 | Method: symmetricDifference 188 | Calculates the SYMMETRICDIFFERENCE of the given WindLy-Object and the current instance 189 | 190 | The result only contains Objects which 191 | have not been in the current instance as well as not in the given WindLy-Object (Removes items which occur in both lists) 192 | 193 | Parameters: 194 | oWindy - Object to operate with 195 | */ 196 | symmetricDifference(oWindLy) { 197 | result := new WindLy(this.debug) 198 | u := new WindLy(this.debug) 199 | i := new WindLy(this.debug) 200 | 201 | ; The symmetric difference is the union without the intersection: 202 | u.list := this.list.Clone() 203 | u.union(oWindly) 204 | for key, data in u.list { 205 | OutputDebug % " UNION:" key ": " data.hwnd ": " data.title " (" key ")" 206 | } 207 | i.list := this.list.Clone() 208 | i.intersection(oWindly) 209 | for key, data in i.list { 210 | OutputDebug % " UNION:" key ": " data.hwnd ": " data.title " (" key ")" 211 | } 212 | 213 | u.difference(i) 214 | 215 | this.list := u.list.Clone() 216 | return this.list 217 | } 218 | /* ------------------------------------------------------------------------------- 219 | Method: union 220 | Calculates the UNION of the given WindLy-Object and the current instance 221 | 222 | The Union contains all elements from the current instance as well as the given WindLy-object 223 | 224 | Parameters: 225 | oWindLy - Object to be used for calculating union 226 | */ 227 | union(oWindLy) { 228 | for currhwnd, data in oWindLy.list { 229 | this.insert(data) 230 | } 231 | return this.list 232 | } 233 | 234 | ; ######################## Internal Methods - not to be called directly ############################################ 235 | ; ===== Internal Methods ========================================================= 236 | /*! ------------------------------------------------------------------------------- 237 | method: __all 238 | Gets all currently openend windows and returns as a List of Objects (*INTERNAL*) 239 | 240 | Returns: 241 | List of Objects 242 | */ 243 | __all() { 244 | dbgOut(">[" A_ThisFunc "()]", this.debug) 245 | hwnds := this.__hwnds(true) 246 | ret := {} 247 | 248 | Loop % hwnds.MaxIndex() { 249 | h_Wnd := hwnds[A_Index] 250 | h_WndHex := this.__hexStr(h_Wnd) 251 | _w := new Windy(h_Wnd, this.debug) 252 | ret[h_WndHex] := _w 253 | } 254 | dbgOut("<[" A_ThisFunc "()]", this.debug) 255 | return ret 256 | } 257 | /*! --------------------------------------------------------------------------------------- 258 | Method: __hwnds 259 | Determines handles of all current windows(*INTERNAL*) 260 | 261 | Parameters: 262 | windowsonly - Flag to filter on "real windows" (Default: *true*) 263 | 264 | Returns: 265 | Array with determined window handles 266 | */ 267 | __hwnds(windowsOnly = true) { 268 | ret := Object() 269 | WinGet, _Wins, List 270 | 271 | Loop %_Wins% 272 | { 273 | h_Wnd:=_Wins%A_Index% 274 | h_WndHex := this.__hexStr(h_Wnd) 275 | bAdd := true 276 | if (windowsOnly = true) { 277 | bAdd := this.__isRealWindow(h_Wnd) 278 | } 279 | if (bAdd = true) { 280 | ret.Insert(h_WndHex) 281 | } 282 | } 283 | return ret 284 | 285 | 286 | } 287 | /*! --------------------------------------------------------------------------------------- 288 | Method: __isRealWindow 289 | Checks whether the given hWnd refers to a TRUE window (As opposed to the desktop or a menu, etc.) (*INTERNAL*) 290 | 291 | Parameters: 292 | hwnd - Handle of window to check (*Obligatory*) 293 | 294 | Returns: 295 | true (window is a true window), false (window is not a true window) 296 | 297 | Author(s): 298 | Original - 299 | */ 300 | __isRealWindow(h_Wnd) { 301 | WinGet, s, Style, ahk_id %h_Wnd% 302 | ret := s & WS.CAPTION ? (s & WS.POPUP ? 0 : 1) : 0 303 | dbgOut("=[" A_ThisFunc "([hWnd=" h_wnd "])] -> " ret, this.debug) 304 | return ret 305 | } 306 | /*! ------------------------------------------------------------------------------- 307 | method: __reset 308 | Initializes all the data (*INTERNAL*) 309 | */ 310 | __reset() { 311 | dbgOut("=[" A_ThisFunc "()]", this.debug) 312 | this._wl := {} 313 | } 314 | /* --------------------------------------------------------------------------------------- 315 | Method: __New 316 | Constructor (*INTERNAL*) 317 | 318 | Parameters: 319 | _debug - Flag to enable debugging (Optional - Default: 0) 320 | */ 321 | __New(_debug=0) { 322 | this._debug := _debug 323 | dbgOut(">[" A_ThisFunc "()] (version: " this._version ")", _debug) 324 | 325 | if % (A_AhkVersion < "1.1.20.02" || A_AhkVersion >= "2.0") { 326 | MsgBox 16, Error, %A_ThisFunc% :`n This class only needs AHK later than 1.1.20.01 (and before 2.0)`nAborting... 327 | if (this._debug) ; _DBG_ 328 | OutputDebug % "<[" A_ThisFunc "(...) -> ()]: *ERROR* : This class needs AHK later than 1.1.20.01 (and before 2.0). Aborting..." ; _DBG_ 329 | return 330 | } 331 | dbgOut("<[" A_ThisFunc "()]", _debug) 332 | return this 333 | } 334 | /*! --------------------------------------------------------------------------------------- 335 | Method: ____hexStr 336 | Converts number to hex representation (*INTERNAL*) 337 | */ 338 | __hexStr(i) { 339 | OldFormat := A_FormatInteger ; save the current format as a string 340 | SetFormat, Integer, Hex 341 | i += 0 ;forces number into current fomatinteger 342 | SetFormat, Integer, %OldFormat% ;if oldformat was either "hex" or "dec" it will restore it to it's previous setting 343 | return i 344 | } 345 | 346 | __decStr(i) { 347 | OldFormat := A_FormatInteger ; save the current format as a string 348 | SetFormat, Integer, D 349 | i += 0 ;forces number into current fomatinteger 350 | SetFormat, Integer, %OldFormat% ;if oldformat was either "hex" or "dec" it will restore it to it's previous setting 351 | return i 352 | } 353 | } 354 | -------------------------------------------------------------------------------- /lib/Windy/_WindowHandlerEvent.ahk: -------------------------------------------------------------------------------- 1 | /* 2 | Title: _WindowHandlerEvent.ahk 3 | Helper classes to define constants for different events 4 | 5 | Author: 6 | hoppfrosch@ahk4.me 7 | 8 | License: 9 | This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. 10 | 11 | Changelog: 12 | 13 | 0.1.0 - [+] Initial 14 | 15 | */ 16 | 17 | class CONST_EVENT{ 18 | ; see: http://msdn.microsoft.com/en-us/library/windows/desktop/dd318066%28v=vs.85%29.aspx 19 | class SYSTEM { 20 | static SOUND := 0x0001 21 | static ALERT := 0x0002 22 | static FOREGROUND := 0x0003 23 | static MENUSTART := 0x0004 24 | static MENUEND := 0x0005 25 | static MENUPOPUPSTART := 0x0006 26 | static MENUPOPUPEND := 0x0007 27 | static CAPTURESTART := 0x0008 28 | static CAPTUREEND := 0x0009 29 | static MOVESIZESTART := 0x000A 30 | static MOVESIZEEND := 0x000B 31 | static CONTEXTHELPSTART := 0x000C 32 | static CONTEXTHELPEND := 0x000D 33 | static DRAGDROPSTART := 0x000E 34 | static DRAGDROPEND := 0x000F 35 | static DIALOGSTART := 0x0010 36 | static DIALOGEND := 0x0011 37 | static SCROLLINGSTART := 0x0012 38 | static SCROLLINGEND := 0x0013 39 | static SWITCHSTART := 0x0014 40 | static SWITCHEND := 0x0015 41 | static MINIMIZESTART := 0x0016 42 | static MINIMIZEEND := 0x0017 43 | static DESKTOPSWITCH := 0x0020 44 | static END := 0x00FF 45 | static ARRANGMENTPREVIEW := 0x8016 46 | } 47 | 48 | class OBJECT { 49 | static CREATE := 0x8000 ; hwnd + ID + idChild is created item 50 | static DESTROY := 0x8001 ; hwnd + ID + idChild is destroyed item 51 | static SHOW := 0x8002 ; hwnd + ID + idChild is shown item 52 | static HIDE := 0x8003 ; hwnd + ID + idChild is hidden item 53 | static REORDER := 0x8004 ; hwnd + ID + idChild is parent of zordering children 54 | static FOCUS := 0x8005 ; hwnd + ID + idChild is focused item 55 | static SELECTION := 0x8006 ; hwnd + ID + idChild is selected item (if only one), or idChild is OBJID_WINDOW if complex 56 | static SELECTIONADD := 0x8007 ; hwnd + ID + idChild is item added 57 | static SELECTIONREMOVE := 0x8008 ; hwnd + ID + idChild is item removed 58 | static SELECTIONWITHIN := 0x8009 ; hwnd + ID + idChild is parent of changed selected items 59 | static STATECHANGE := 0x800A ; hwnd + ID + idChild is item w/ state change 60 | static LOCATIONCHANGE := 0x800B ; hwnd + ID + idChild is moved/sized item 61 | static NAMECHANGE := 0x800C ; hwnd + ID + idChild is item w/ name change 62 | static DESCRIPTIONCHANGE := 0x800D ; hwnd + ID + idChild is item w/ desc change 63 | static VALUECHANGE := 0x800E ; hwnd + ID + idChild is item w/ value change 64 | static PARENTCHANGE := 0x800F ; hwnd + ID + idChild is item w/ new parent 65 | static HELPCHANGE := 0x8010 ; hwnd + ID + idChild is item w/ help change 66 | static DEFACTIONCHANGE := 0x8011 ; hwnd + ID + idChild is item w/ def action change 67 | static ACCELERATORCHANGE := 0x8012 ; hwnd + ID + idChild is item w/ keybd accel change 68 | static INVOKED := 0x8013 ; hwnd + ID + idChild is item invoked 69 | static TEXTSELECTIONCHANGED := 0x8014 ; hwnd + ID + idChild is item w? test selection change 70 | static CONTENTSCROLLED := 0x8015 71 | static END := 0x80FF 72 | } 73 | } 74 | 75 | class CONST_HSHELL { 76 | static WINDOWCREATED := 1 77 | static WINDOWDESTROYED := 2 78 | static ACTIVATESHELLWINDOW := 3 79 | static WINDOWACTIVATED := 4 80 | static GETMINRECT := 5 81 | static REDRAW := 6 82 | static TASKMAN := 7 83 | static LANGUAGE := 8 84 | static SYSMENU := 9 85 | static ENDTASK := 10 86 | static ACCESSIBILITYSTATE := 11 87 | static APPCOMMAND := 12 88 | static WINDOWREPLACED := 13 89 | static WINDOWREPLACING := 14 90 | static HIGHBIT := 0x8000 91 | static FLASH := (6|0x8000) 92 | static RUDEAPPACTIVATED := (4|0x8000) 93 | } 94 | 95 | ; Simple helper function to translate system constants (Event-IDs) in human readable strings 96 | Event2Str(id) { 97 | ret := id 98 | if (id = CONST_EVENT.SYSTEM.SOUND) 99 | ret := "SYSTEM.SOUND" 100 | else if (id = CONST_EVENT.SYSTEM.ALERT) 101 | ret := "SYSTEM.ALERT" 102 | else if (id = CONST_EVENT.SYSTEM.FOREGROUND) 103 | ret := "SYSTEM.FOREGROUND" 104 | else if (id = CONST_EVENT.SYSTEM.MENUSTART) 105 | ret := "SYSTEM.MENUSTART" 106 | else if (id = CONST_EVENT.SYSTEM.MENUEND) 107 | ret := "SYSTEM.MENUEND" 108 | else if (id = CONST_EVENT.SYSTEM.MENUPOPUPSTART) 109 | ret := "SYSTEM.MENUPOPUPSTART" 110 | else if (id = CONST_EVENT.SYSTEM.MENUPOPUPEND) 111 | ret := "SYSTEM.MENUPOPUPEND" 112 | else if (id = CONST_EVENT.SYSTEM.CAPTURESTART) 113 | ret := "SYSTEM.CAPTURESTART" 114 | else if (id = CONST_EVENT.SYSTEM.CAPTUREEND) 115 | ret := "SYSTEM.CAPTUREEND" 116 | else if (id = CONST_EVENT.SYSTEM.MOVESIZESTART) 117 | ret := "SYSTEM.MOVESIZESTART" 118 | else if (id = CONST_EVENT.SYSTEM.MOVESIZEEND) 119 | ret := "SYSTEM.MOVESIZEEND" 120 | else if (id = CONST_EVENT.SYSTEM.CONTEXTHELPSTART) 121 | ret := "SYSTEM.CONTEXTHELPSTART" 122 | else if (id = CONST_EVENT.SYSTEM.CONTEXTHELPEND) 123 | ret := "SYSTEM.CONTEXTHELPEND" 124 | else if (id = CONST_EVENT.SYSTEM.DRAGDROPSTART) 125 | ret := "SYSTEM.DRAGDROPSTART" 126 | else if (id = CONST_EVENT.SYSTEM.DRAGDROPEND) 127 | ret := "SYSTEM.DRAGDROPEND" 128 | else if (id = CONST_EVENT.SYSTEM.DIALOGSTART) 129 | ret := "SYSTEM.DIALOGSTART" 130 | else if (id = CONST_EVENT.SYSTEM.DIALOGEND) 131 | ret := "SYSTEM.DIALOGEND" 132 | else if (id = CONST_EVENT.SYSTEM.SCROLLINGSTART) 133 | ret := "SYSTEM.SCROLLINGSTART" 134 | else if (id = CONST_EVENT.SYSTEM.SCROLLINGEND) 135 | ret := "SYSTEM.SCROLLINGEND" 136 | else if (id = CONST_EVENT.SYSTEM.SWITCHSTART) 137 | ret := "SYSTEM.SWITCHSTART" 138 | else if (id = CONST_EVENT.SYSTEM.SWITCHEND) 139 | ret := "SYSTEM.SWITCHEND" 140 | else if (id = CONST_EVENT.SYSTEM.MINIMIZESTART) 141 | ret := "SYSTEM.MINIMIZESTART" 142 | else if (id = CONST_EVENT.SYSTEM.MINIMIZEEND) 143 | ret := "SYSTEM.MINIMIZEEND" 144 | else if (id = CONST_EVENT.SYSTEM.DESKTOPSWITCH) 145 | ret := "SYSTEM.DESKTOPSWITCH" 146 | else if (id = CONST_EVENT.SYSTEM.END) 147 | ret := "SYSTEM.END" 148 | else if (id = CONST_EVENT.OBJECT.CREATE) 149 | ret := "OBJECT.CREATE" 150 | else if (id = CONST_EVENT.OBJECT.DESTROY) 151 | ret := "OBJECT.DESTROY" 152 | else if (id = CONST_EVENT.OBJECT.SHOW) 153 | ret := "OBJECT.SHOW" 154 | else if (id = CONST_EVENT.OBJECT.HIDE) 155 | ret := "OBJECT.HIDE" 156 | else if (id = CONST_EVENT.OBJECT.REORDER) 157 | ret := "OBJECT.REORDER" 158 | else if (id = CONST_EVENT.OBJECT.FOCUS) 159 | ret := "OBJECT.FOCUS" 160 | else if (id = CONST_EVENT.OBJECT.SELECTION) 161 | ret := "OBJECT.SELECTION" 162 | else if (id = CONST_EVENT.OBJECT.SELECTIONADD) 163 | ret := "OBJECT.SELECTIONADD" 164 | else if (id = CONST_EVENT.OBJECT.SELECTIONREMOVE) 165 | ret := "OBJECT.SELECTIONREMOVE" 166 | else if (id = CONST_EVENT.OBJECT.SELECTIONWITHIN) 167 | ret := "OBJECT.SELECTIONWITHIN" 168 | else if (id = CONST_EVENT.OBJECT.STATECHANGE) 169 | ret := "OBJECT.STATECHANGE" 170 | else if (id = CONST_EVENT.OBJECT.LOCATIONCHANGE) 171 | ret := "OBJECT.LOCATIONCHANGE" 172 | else if (id = CONST_EVENT.OBJECT.NAMECHANGE) 173 | ret := "OBJECT.NAMECHANGE" 174 | else if (id = CONST_EVENT.OBJECT.DESCRIPTIONCHANGE) 175 | ret := "OBJECT.DESCRIPTIONCHANGE" 176 | else if (id = CONST_EVENT.OBJECT.VALUECHANGE) 177 | ret := "OBJECT.VALUECHANGE" 178 | else if (id = CONST_EVENT.OBJECT.PARENTCHANGE) 179 | ret := "OBJECT.PARENTCHANGE" 180 | else if (id = CONST_EVENT.OBJECT.HELPCHANGE) 181 | ret := "OBJECT.HELPCHANGE" 182 | else if (id = CONST_EVENT.OBJECT.DEFACTIONCHANGE) 183 | ret := "OBJECT.DEFACTIONCHANGE" 184 | else if (id = CONST_EVENT.OBJECT.ACCELERATORCHANGE) 185 | ret := "OBJECT.ACCELERATORCHANGE" 186 | else if (id = CONST_EVENT.OBJECT.INVOKED) 187 | ret := "OBJECT.INVOKED" 188 | else if (id = CONST_EVENT.OBJECT.TEXTSELECTIONCHANGED) 189 | ret := "OBJECT.TEXTSELECTIONCHANGED" 190 | else if (id = CONST_EVENT.OBJECT.CONTENTSCROLLED) 191 | ret := "OBJECT.CONTENTSCROLLED" 192 | else if (id = CONST_EVENT.SYSTEM.ARRANGMENTPREVIEW) 193 | ret := "SYSTEM.ARRANGMENTPREVIEW" 194 | else if (id = CONST_EVENT.OBJECT.END) 195 | ret := "OBJECT.END" 196 | 197 | if (ret = "") 198 | ret := id 199 | return ret 200 | } 201 | --------------------------------------------------------------------------------