RegionWaitChange: wait for region to change or stop changing
#1
Posted 15 August 2007 - 04:56 PM
Download
#2
Posted 02 September 2007 - 12:50 AM
Since I know some people have asked for this, I'm surprised no one replied. I suspect it's definitely getting used though!
#3
Posted 02 September 2007 - 01:20 AM
I have a suggestion. Use DeleteDC, not ReleaseDC, for hcdc.
#4
Posted 02 September 2007 - 11:11 AM
#5
Posted 05 September 2007 - 12:18 PM
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
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
#6
Posted 05 September 2007 - 01:22 PM
#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
ReturnIf you still can't get your script to work please post it.
#7
Posted 05 September 2007 - 07:16 PM
#8
Posted 05 September 2007 - 11:21 PM
#9
Posted 06 September 2007 - 01:44 AM
#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
#10
Posted 26 May 2009 - 03:27 AM
#11
Posted 26 May 2009 - 04:13 AM
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!
SetTimer, SomethingToDo, 5000 RegionWaitWhatever(arg, arrg, arrrg) SetTimer, SomethingToDo, off return SomethingToDo: msgbox, 0, Working...,...yeah, right., 3 return:lol:
#12
guest3456
Posted 27 September 2010 - 01:49 AM
which is the correct license for this function?
#13
Posted 19 May 2011 - 02:40 AM
#14
Posted 28 June 2012 - 12:50 AM
It actually hasn't worked for me on some computers however, I chased it down to GetHashCode() always returning null.
Turns out DllCall("advapi32\CryptAcquireContext doesn't always work immediately, I was getting NTE_BAD_KEYSET error. I used
<!-- m -->http://msdn.microsof...ry ... 85).aspx<!-- m -->
as a guide to fix it:
GetHashCode(ByRef data, len = -1, alg_id = 0x8003) {
err := DllCall("advapi32\CryptAcquireContext", "UIntP", hProv, "UInt", 0, "UInt", 0, "UInt", 1, "UInt", 0) ; PROV_RSA_FULL = 1
if err = 0
{
err := DllCall("GetLastError")
if (err & 0xFFFFFFFF) = 0x80090016 ;NTE_BAD_KEYSET
{
;No default container was found. Attempt to create it.
err := DllCall("advapi32\CryptAcquireContext", "UIntP", hProv, "UInt", 0, "UInt", 0, "UInt", 1, "UInt", 8) ; PROV_RSA_FULL = 1, CRYPT_NEWKEYSET = 0x00000008
if err = 0
{
msgbox, Problem with the WinCypt subsystem
exit
}
}
}
DllCall("advapi32\CryptCreateHash", "UInt", hProv, "UInt", alg_id, "UInt", 0, "UInt", 0, "UIntP", hHash)
DllCall("advapi32\CryptHashData", "UInt", hHash, "UInt", &data, "UInt", len < 0 ? VarSetCapacity(data) : len, "UInt", 0)
ssz := VarSetCapacity(sz, 4, 0)
DllCall("advapi32\CryptGetHashParam", "UInt", hHash, "UInt", 4, "UIntP", sz, "UIntP", ssz, "UInt", 0)
VarSetCapacity(HashVal, sz, 0)
DllCall("advapi32\CryptGetHashParam", "UInt", hHash, "UInt", 2, "UInt", &HashVal, "UIntP", sz, "UInt", 0)
BinaryToString(str, HashVal, false, sz)
DllCall("advapi32\CryptDestroyHash", "UInt", hHash)
DllCall("advapi32\CryptReleaseContext", "UInt", hProv, "UInt", 0)
Return, str
}
Cheers,
Andrew




