Huggen Posted November 5, 2008 Share Posted November 5, 2008 Hey all need help with this script quite simple....I need it to check 2 areas if one of them changes it should say MsgBox(0, "", "Something in the 1 region has changed!") or MsgBox(0, "", "Something in the 2 region has changed!") but it spamms: MsgBox(0, "", "Something in the 1 region has changed!") and it haven´t.....what script should work? expandcollapse popupHotKeySet('{F6}', '_Start') HotKeySet('{F7}', 'stop') HotKeySet('{F8}', 'end') While 1 Sleep(25) Wend Func stop() While 1 Sleep(25) Wend EndFunc Func _Start() While 1=1 ; Wait until something changes in the region 0,0 to 50,50 ; Get initial checksum $checksum = PixelChecksum(0,0, 50,50) $checksum1 = PixelChecksum(50,50, 100,50) ; Wait for the region to change, the region is checked every 100ms to reduce CPU load sleep(100) if $checksum = PixelChecksum(0,0, 50,50) Then MsgBox(0, "", "Something in the 1 region has changed!") elseif $checksum1 = PixelChecksum(50,50, 100,50) Then MsgBox(0, "", "Something in the 2 region has changed!") endif WEnd EndFunc Func end() Exit EndFunc Link to comment Share on other sites More sharing options...
ofLight Posted November 5, 2008 Share Posted November 5, 2008 (edited) I havent tested the your code , but one potential problem I see is the "Get initial checksum" is Inside your while loop shouldnt it be like this? If not, I may not understand exactly wutt u mean to try? Edited November 5, 2008 by ofLight There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
ofLight Posted November 5, 2008 Share Posted November 5, 2008 (edited) Oppp, I also Saw, u need to change your if $checksum1 = PixelChecksum(0,0, 50,50) Then to if $checksum1 <> PixelChecksum(0,0, 50,50) Then HotKeySet('{F6}', '_Start') HotKeySet('{F7}', 'stop') HotKeySet('{F8}', 'end') While 1 Sleep(25) Wend Func stop() While 1 Sleep(25) Wend EndFunc Func _Start() ; Get initial checksum $checksum1 = PixelChecksum(0,0, 50,50) $checksum2 = PixelChecksum(50,50, 100,50) While 1 ; Wait for the region to change, the region is checked every 100ms to reduce CPU load if $checksum1 <> PixelChecksum(0,0, 50,50) Then MsgBox(0, "", "Something in the 1 region has changed!") ExitLoop elseif $checksum2 <> PixelChecksum(50,50, 100,50) Then MsgBox(0, "", "Something in the 2 region has changed!") ExitLoop endif sleep(100) WEnd EndFunc Func end() Exit EndFunc Edited November 5, 2008 by ofLight There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
senthor Posted November 5, 2008 Share Posted November 5, 2008 (edited) I don't know If I understood everything but shouldn't it be: expandcollapse popupHotKeySet('{F6}', '_Start') HotKeySet('{F7}', 'stop') HotKeySet('{F8}', 'end') While 1 Sleep(25) Wend Func stop() While 1 Sleep(25) Wend EndFunc Func _Start() ; Get initial checksum $checksum = PixelChecksum(0,0, 50,50) $checksum1 = PixelChecksum(50,50, 100,50) While 1 ; Wait until something changes in the region 0,0 to 50,50 ; Wait for the region to change, the region is checked every 100ms to reduce CPU load sleep(100) if $checksum <> PixelChecksum(0,0, 50,50) Then ; is NOT $checksum = PixelChecksum(0,0, 50,50) ; get new default MsgBox(0, "", "Something in the 1 region has changed!") Sleep(100) ; wait some time to let the old window be active again elseif $checksum1 <> PixelChecksum(50,50, 100,50) Then ; is NOT $checksum1 = PixelChecksum(50,50, 100,50) ; get new default MsgBox(0, "", "Something in the 2 region has changed!") Sleep(100) ; wait some time to let the old window be active again endif WEnd EndFunc Func end() Exit EndFunc senthor Edited November 5, 2008 by senthor FileListToArray UDFMy tools Link to comment Share on other sites More sharing options...
Huggen Posted November 5, 2008 Author Share Posted November 5, 2008 (edited) Yea, thanks to all....I learn something but still not working (like I it should) It seems to me that it can´t be more than 1 "PixelChecksum()" in a function.... but I maybe wrong? too them that diden´t understand what I wanted was. it checks to areas.... 1 and 2 if area 1 changes then it says " area 1 have change" and if area 2 changes it says " area 2 have change" did you all get it now? EDIT: btw never mind....I´m so dumb thought wrong about the x and y on the window....script works thanks all Edited November 5, 2008 by Huggen Link to comment Share on other sites More sharing options...
Huggen Posted November 5, 2008 Author Share Posted November 5, 2008 Never mind it work i though wrong about the x andy on the window...thanks any way Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now