Sign in to follow this  
Followers 0
Fossil Rock

_ispressed Problem

8 posts in this topic

This code runs wild on the last case statement. Can someone tell me why?

#include <misc.au3>

HotKeySet("{ESC}", "exit")

While 1
            Select
                Case _IsPressed (Hex(96))  = 1
                    Send("Text A {enter}")
                Case _IsPressed (Hex(97))  = 1
                    Send("Text B {enter}")
                Case _IsPressed (Hex(98))  = 1
                    Send("Text C {enter}")
                Case _IsPressed (Hex(99))  = 1
                    Send("Text D {enter}")
            EndSelect
WEnd

Func exit()
    Exit
EndFunc

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites



Tried several in different locations but..... haven't found the magic yet.


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

#include <misc.au3>

HotKeySet("{ESC}", "exit")

While 1
            Select
                Case _IsPressed (Hex(96))  = 1
                    Send("Text A {enter}")
                Case _IsPressed (Hex(97))  = 1
                    Send("Text B {enter}")
                Case _IsPressed (Hex(98))  = 1
                    Send("Text C {enter}")
                Case _IsPressed (Hex(99))  = 1
                    Send("Text D {enter}")
            EndSelect
            Sleep(100)
WEnd

Func exit()
    Exit
EndFunc

This better?

#)

Share this post


Link to post
Share on other sites

Done that and in all the other logical locations. Run the code to see what happens.


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

Global $DllUser32 = DllOpen('user32')
While 1
    Sleep ( 10 )
    If _IsPressed(0x30) Then
         Send("Text A {enter}")
    ENdif
    If _IsPressed(0x31) Then
         Send("Text B {enter}")
    ENdif
    If _IsPressed(0x32) Then
         Send("Text C {enter}")
    ENdif
    If _IsPressed(0x33) Then
         Send("Text D {enter}")
    EndIf
WEnd
;DllClose($dll)
Func _IsPressed($hexKey)
    Local $aR
    $aR = DllCall($DllUser32, "int", "GetAsyncKeyState", "int", $hexKey)
    If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

This works, for some reason...

0Text A

,1Text B

,2Text C

,3Text D

on the numerical strip on the top o you keyboard.

0Text A

1Text B

2Text C

3Text D

:mellow:

I seem to still have my test on!Text B

:) ...

#)

Share this post


Link to post
Share on other sites

instead of 0x30 try just

_IsPressed('30')

~cdkid


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

Still runs wild.... does it not run keep typing the text for you when you press just one key or no key at all ?


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

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