Sign in to follow this  
Followers 0
EricBBB

What happened to getkeystate? Need quick help please

6 posts in this topic

Hey everyone,

I just switched from Autohotkey to Autoit v3. So im learning all the differences between the versions of autoit and such. Anyways, Im not sure what happened to the getkeystate command or how its called on this version. But could one of you more experienced guys help me set up a loop that ends when the enter key is pressed. I noticed that all the loops in version 3 are do whiles or do untils. So im trying to

DO

SCRIPT

UNTIL ENTER KEY PUSHED

can i get some help with the loop code please?

Share this post


Link to post
Share on other sites



Well we have both _IsPressed and HotKeySet. HotKeySet just binds a key to a functions, _IsPressed well...checks if a key is pressed.

Share this post


Link to post
Share on other sites

Well we have both _IsPressed and HotKeySet. HotKeySet just binds a key to a functions, _IsPressed well...checks if a key is pressed.

But whats the description for enter? I dont know the ASCII stuff. I tried looking it up on microsoft that was a disaster.

Would it look something like Until "Enter" _ispressed ?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

GetKeyState is also a native function on the Windows platform. You can call it yourself using DllCall.

If you use HotKeySet, you would just call

HotKeySet("{ENTER}", "MyFunc")

While 1
;do whatever
WEnd

Func MyFunc
    MsgBox(0, "Yay", "Yay")
EndFunc
Edited by Richard Robertson

Share this post


Link to post
Share on other sites

The Ascii codes are in the help file under "Appendix".

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    TrayTip("I'm Waiting","Please press ENTER sometime today!!", 30)
    If _IsPressed("0d", $dll) Then
        MsgBox(0,"_IsPressed", "Enter Key Pressed")
        ExitLoop
    EndIf
WEnd
DllClose($dll)

Share this post


Link to post
Share on other sites

The Ascii codes are in the help file under "Appendix".

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    TrayTip("I'm Waiting","Please press ENTER sometime today!!", 30)
    If _IsPressed("0d", $dll) Then
        MsgBox(0,"_IsPressed", "Enter Key Pressed")
        ExitLoop
    EndIf
WEnd
DllClose($dll)
Thanks for your help guys, sorry for being so new to this

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