Sign in to follow this  
Followers 0
ramirez

Keystroke Count

8 posts in this topic

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

Share this post


Link to post
Share on other sites



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)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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.

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0