Jump to content

_IsPressed declaration error


Recommended Posts

CODE
$push = 0

While 1

If _IsPressed($s_24) Then

If $push = 0 Then

Sleep(1000)

EndIf

$push = 1

EndIf

If Not _IsPressed($s_24) Then $push = 0

WEnd

WARNING: $s_24: possibly used before declaration.

It does not seem to matter if I put my variable as plain 24, $s_24, or 23. No doubt there is a simple answer...all I can say is that I've read the examples and Help file.

Thanks in advance!

Edited by Confounded
Link to comment
Share on other sites

CODE
$push = 0

While 1

If _IsPressed($s_24) Then

If $push = 0 Then

Sleep(1000)

EndIf

$push = 1

EndIf

If Not _IsPressed($s_24) Then $push = 0

WEnd

WARNING: $s_24: possibly used before declaration.

It does not seem to matter if I put my variable as plain 24, $s_24, or 23. No doubt there is a simple answer...all I can say is that I've read the examples and Help file.

Thanks in advance!

#include <Misc.au3>
$push = 0
        While 1
            If _IsPressed(24) Then
                If $push = 0 Then
                Sleep(1000)
                EndIf
                $push = 1
            EndIf
            If Not _IsPressed(24) Then $push = 0
        WEnd

better?

Link to comment
Share on other sites

what are you trying to represent with $S_24? the variable is undeclared, so thats why its causing you problems. I took a look at the help file and in the remarks it shows all the values, so you should just be able to pop one right into the function and have it run correctly.

heres what i came up with (assuming you were trying to detect when the "Home" key is pressed, if not your going to have to find the value for the key your trying to detect in the help file)

;AutoIt Version: 3.2.1.14 (beta)

#Include <Misc.au3>

$push = 0

While 1
    If _IsPressed(24) Then
        If $push = 0 Then
            Sleep(1000)
        EndIf
        $push = 1
    EndIf
    If Not _IsPressed(24) Then $push = 0
WEnd

does that help?

edit: seems i was beaten x.x

Edited by Kourath
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...