ramirez Posted August 21, 2009 Share Posted August 21, 2009 Hi all. I've used the "forum master tool" Search but there was no correct answer. My script make a query on some DB and the result is showed in a board with 4 lines. Sometimes the query results in a lot of lines and I need to press down-arrow key some times. What I need is in the end to know the number of times that the down key is pressed. Can someone help? Thanks in advance Link to comment Share on other sites More sharing options...
Bert Posted August 21, 2009 Share Posted August 21, 2009 Hi all. I've used the "forum master tool" Search but there was no correct answer. My script make a query on some DB and the result is showed in a board with 4 lines. Sometimes the query results in a lot of lines and I need to press down-arrow key some times. What I need is in the end to know the number of times that the down key is pressed. Can someone help? Thanks in advance Take a look at _ispressed() Here is an example from the helpfile on how to use it: #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("23", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIf WEnd DllClose($dll) The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
ramirez Posted August 21, 2009 Author Share Posted August 21, 2009 Thanks Volly The _IsPressed only check if key has been pressed and prints a message everytime the event is true. What I need is to know the number of times the key is pressed. Press the ArrowKeyDown until pixel X color = "******" Count the number of times the ArrowKeyDown was pressed Print the result Link to comment Share on other sites More sharing options...
jvanegmond Posted August 21, 2009 Share Posted August 21, 2009 Think! You have all the functions you needed, you just had to put a counter on it! #include <Misc.au3> Dim $dll = DllOpen("user32.dll") Dim $i = 0 While 1 Sleep ( 10 ) If _IsPressed("23", $dll) Then $i += 1 ToolTip($i) While (_IsPressed("23", $dll)) Sleep(10) WEnd EndIf WEnd DllClose($dll) github.com/jvanegmond Link to comment Share on other sites More sharing options...
ramirez Posted August 21, 2009 Author Share Posted August 21, 2009 Allmost there. I bump in a "small" problem This is the code so far #include <Misc.au3> Dim $dll = DllOpen("user32.dll") Dim $i = 0 While 1 Sleep ( 10 ) If _IsPressed("28", $dll) Then $i += 1 ToolTip($i) Do Send("{PGDN}") Until PixelGetColor( 88 , 974 ) = "000000" ; While (_IsPressed("28", $dll)) ; Sleep(10) ; WEnd EndIf WEnd DllClose($dll) But I've found tha the send is not the same as real press. Link to comment Share on other sites More sharing options...
omikron48 Posted August 21, 2009 Share Posted August 21, 2009 What is your script supposed to do? As it is, what I see is that It will check to see if down is pressed, and if it is, it will keep sending pgdn until the pixel turns black, then it checks if the down key is pressed again. Is that really how it's supposed to work? Link to comment Share on other sites More sharing options...
ramirez Posted August 21, 2009 Author Share Posted August 21, 2009 What is your script supposed to do?As it is, what I see is that It will check to see if down is pressed, and if it is, it will keep sending pgdn until the pixel turns black, then it checks if the down key is pressed again.Is that really how it's supposed to work?The code at this moment press {Down} until pixelcolor is = <color> but the problem is that the _IsPressed is not the same as you press the real key.The ToolTip only count the times that I "Real" press the down key. Link to comment Share on other sites More sharing options...
bogQ Posted August 21, 2009 Share Posted August 21, 2009 (edited) you need to add one more $i += 1 #include <Misc.au3> Dim $i = 0 While 1 Sleep ( 10 ) If _IsPressed ( "28" ) Then $i += 1 ToolTip ( $i ) If "0x" & Hex ( PixelGetColor ( 88 , 974 ) , 6) <> "0x000000" Then Do Send ( "{DOWN}" ) $i += 1 ToolTip ( $i ) Until "0x" & Hex ( PixelGetColor ( 88 , 974 ) , 6) = "0x000000" EndIf MsgBox(0,"",$i) $i = 0 EndIf WEnd Edited August 21, 2009 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. 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