AutoHotkey Community

It is currently May 25th, 2012, 6:35 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: August 15th, 2007, 5:56 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
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

_________________
GitHubScriptsIronAHK Contact by email not private message.


Last edited by polyethene on September 6th, 2007, 8:50 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 1:50 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 2:20 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 12:11 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
I see why that's necessary, updated. Thanks guys.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 5th, 2007, 1:18 pm 
Offline

Joined: July 15th, 2005, 3:19 pm
Posts: 140
Location: Denmark
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 5th, 2007, 2:22 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
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.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 5th, 2007, 8:16 pm 
Offline

Joined: July 15th, 2005, 3:19 pm
Posts: 140
Location: Denmark
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 6th, 2007, 12:21 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
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.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 6th, 2007, 2:44 am 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2009, 4:27 am 
Offline

Joined: April 13th, 2009, 3:15 am
Posts: 101
I'm if correct that script waits until a region has changed or stops changing, meaning it pauses the script? How do I make it so that the script continues until the region changes? Thanks!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2009, 5:13 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3328
Location: Simi Valley, CA
lbrtdy wrote:
I'm if correct that script waits until a region has changed or stops changing, meaning it pauses the script? How do I make it so that the script continues until the region changes? Thanks!
Code:
SetTimer, SomethingToDo, 5000
RegionWaitWhatever(arg, arrg, arrrg)
SetTimer, SomethingToDo, off
return
SomethingToDo:
msgbox, 0, Working...,...yeah, right., 3
return
:lol:

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 27th, 2010, 2:49 am 
in the zip, the files have GPL licenses, but on your scripts webpage, it says BSD license

which is the correct license for this function?


Report this post
Top
  
Reply with quote  
 Post subject: WaitRegionStatic
PostPosted: May 19th, 2011, 3:40 am 
Offline

Joined: April 12th, 2011, 10:56 pm
Posts: 3
Location: Canada
Ive been playing with the WaitRegionStatic function because I'd like to write a hotkey which navigates a series of pages on a website and is not dependent on predetermined sleep delays (due to the variability of internet speed this is not feasible). However, I have found that the script always seems to continue before the region actually stops changing. For example, to test this function, I was watching a youtube video of a strobe light and designated a certain pixel to be monitored. Although the entire region was changing colour quite rapidly, the script continued after a few seconds, indicating that the region was static when in fact it was not. I am using windows vista as is required by this function. Any suggestions?


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Rajat and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group