Sign in to follow this  
Followers 0
DWad

Couple relatively simple questions

4 posts in this topic

Ok so first off, I'm trying to write a loop that will run for x seconds. I have unworking code that repeats the script indefinitely..

Could someone post a sample of how to repeat for x milliseconds? I know that I should use timeInit and timerDiff but I haven't gotten anywhere with them, I guess I just don't understand exactly how they work (yes I read the helpfile :))

Also, I have a GUI with a button to set a hotkey to PgDn.

GUICtrlSetOnEvent($bindTo1Button, "bind1")

and

Func bind1()
        HotKeySet ("{pgDn}", "sendWhat")
EndFunc

This part works fine. However, I have 2 other function set up the same way replacing pgDn with LSHIFT or LCTRL and when I try to use them the same way nothing happens. Any idea here or do I need to supply some more info?

Thanks guys.

Share this post


Link to post
Share on other sites



To answer #1

Loop that repeats for X seconds:

$seconds = 5

$timer = TimerInit()
While TimerDiff( $timer ) < $seconds * 1000
    Sleep(10) ; do stuff here
WEnd

As for #2

I need to see the rest of the script to say why the functions are not working.

Share this post


Link to post
Share on other sites

Ah ok, I had an extra variable for the TimeDiff I think, I'll try that out, thanks Danwilli.

As for question 2, the functions themselves are working fine, the only thing I did was change PgDn to LSHIFT or LCTRL to have it set to a different hotkey. I'll post up the code later, probably an id-10-T error in there somewhere.

Share this post


Link to post
Share on other sites

Ok figured it out..after a quick skimming back through the help file again.

Seems you can't set just shift, control, or alt as a hotkey, you have to combine them with someone else.

Thanks again for the help.

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