Jump to content

Wait for key


 Share

Recommended Posts

I'm just trying something simple for a function. How would I use sleep during a function until a key is pressed? I have a hotkey set to call the function, and in the function it follows a command then sleeps but I can't figure out the Do ... Until part. Any suggestions?

Link to comment
Share on other sites

This is what I have so far

#include <Misc.au3>
HotkeySet("+t", "testfunc")
While 1
    Sleep(100)
WEnd

Func testfunc()
    Do 
        ToolTip("Testing", 0, 0)
        Sleep(100)
    Until _IsPressed("45")
EndFuncoÝ÷ Ù:òx-¢­Ûh{­¶¥¢ZÚÞ²éZ¥{!zx©­ë,ªê-z«¨·ú®¢×¢èZ½æ¥­æÊÆ¢vØ^j{0z¶®¶­sb6æ6ÇVFRfÇC´Ö62æS2fwC°¤÷D¶W6WBgV÷C²·BgV÷C²ÂgV÷C·FW7FgVæ2gV÷C²¥vÆR 6ÆVW¥tVæ@ ¤gVæ2FW7FgVæ2 Fð FööÅFgV÷CµFW7FærgV÷C²Â 6ÆVW VçFÂô5&W76VBCR FööÅFgV÷CµFW7FæröfbgV÷C²Â¤VæDgVæ2

I couldnt see anything wrong with it :whistle:

Link to comment
Share on other sites

Yeah it works, but how do I use "e" key to exit the function. I want to get rid of the tooltip as well. I'm not sure if it exits the function or continues it, or it might be the While 1 Sleep, but the tooltip is still there.

#include <Misc.au3>
HotKeySet("+t", "testfunc")
While 1
    Sleep(100)
WEnd

Func testfunc()
    Do
        ToolTip("Testing", 0, 0)
        Sleep(100)
    Until _IsPressed(45)
    ToolTip("", 0, 0)
EndFunc   ;==>testfunc
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...