 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Titan
Joined: 11 Aug 2004 Posts: 5026 Location: imaginationland
|
Posted: Wed Aug 15, 2007 5:56 pm Post subject: RegionWaitChange: wait for region to change or stop changing |
|
|
Waits for a region of a window to change or stop changing by using GDI bitmap functions and MD5 hashes. Requires Windows Vista or Windows XP. Earlier versions of Windows can be supported by using PhiLho and Laszlo's binary encoding libraries, although they're much slower. Details included in the scripts.
Download _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Last edited by Titan on Thu Sep 06, 2007 8:50 am; edited 1 time in total |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sun Sep 02, 2007 1:50 am Post subject: |
|
|
Really nice function. Amazingly compact.
Since I know some people have asked for this, I'm surprised no one replied. I suspect it's definitely getting used though! |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1281
|
Posted: Sun Sep 02, 2007 2:20 am Post subject: |
|
|
I was already aware of this script, but now I actually read it. Excellent stuffs!
I have a suggestion. Use DeleteDC, not ReleaseDC, for hcdc. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5026 Location: imaginationland
|
Posted: Sun Sep 02, 2007 12:11 pm Post subject: |
|
|
I see why that's necessary, updated. Thanks guys. _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
David Andersen
Joined: 15 Jul 2005 Posts: 85 Location: Denmark
|
Posted: Wed Sep 05, 2007 1:18 pm Post subject: |
|
|
Thanks Titan.
The script certainly look interesting, but I cannot get it to work. I am sure it is just my incompetence. Specifically, I cannot see what the following line does
| Code: |
hwnd := WinExist(t)
|
WinExist does not seem to be a function in the documentation, and hwnd is always 0x0.
An example script just measuring change in the active windows would be very good.
Regards,
David |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5026 Location: imaginationland
|
Posted: Wed Sep 05, 2007 2:22 pm Post subject: |
|
|
WinExist() is a built-in function, maybe you need to update your version of AutoHotkey. Here is a working example:
| Code: | #Include RegionWaitChange.ahk
Run, notepad ; open notepad
WinWait, Untitled - Notepad ; wait for window to exist
ControlSetText, Edit1 ; delete any current text
MsgBox, Notepad is empty`, press F12 to fill it with random text.
; monitor the region of 100px width and height from coordinate (10, 10):
RegionWaitChange(10, 10, 100, 100, "Untitled - Notepad")
; once the region changed the script will continue here:
MsgBox, Notepad has changed! (RegionWaitChange completed)
WinClose
ExitApp
F12::
VarSetCapacity(dots, 5000, Asc(".")) ; fill a variable with something
ControlSetText, Edit1, %dots%, Untitled - Notepad ; change the text on notepad artificially
dots = ; free variable
Return |
If you still can't get your script to work please post it. _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
David Andersen
Joined: 15 Jul 2005 Posts: 85 Location: Denmark
|
Posted: Wed Sep 05, 2007 8:16 pm Post subject: |
|
|
Thanks a lot Titan! It works like a charm! One use of this script would be when you start an operation that takes several minutes to finish. It would then be good to be able to push a single hotkey which would monitor the entire screen (maybe even double screens ) and make a sound when the screen changes. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5026 Location: imaginationland
|
Posted: Thu Sep 06, 2007 12:21 am Post subject: |
|
|
Thanks, I appreciate that. I originally wrote this for my game macros but then realized it could be used for other purposes such as event handling in the cases you mentioned. I believe it was a long requested feature as well. _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 773 Location: London, UK
|
Posted: Thu Sep 06, 2007 2:44 am Post subject: |
|
|
Ive just combined this with Rolands Gui from his wincut script to make it even easier for newcomers.
| Code: | #Include RegionWaitChange.ahk
+#LButton::
CoordMode, Mouse
MouseGetPos, sx, sy, win
WinGettitle,title, ahk_id%win%
Gui, +lastfound +alwaysOnTop +toolwindow -caption
Gui, Color, 00FFFF
WinSet, Transparent, 50
Gui, Show, noActivate
Loop {
if !getKeyState("LButton", "p")
break
MouseGetPos, x, y
Gui, Show, % "x" sx "y" sy "w" x-sx "h" y-sy
} WinGetPos, gx, gy, w, h
Gui, destroy
msgbox %title%
RegionWaitstatic(gx, gy, w, h, title)
msgbox
exitapp
return |
_________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|