Sign in to follow this  
Followers 0
Ultratech

Wait for key

9 posts in this topic

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?

Share this post


Link to post
Share on other sites



yes..

show your script so we can help

8)


NEWHeader1.png

Share this post


Link to post
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:

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Works perfectly now. Thanks :whistle:

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