Sign in to follow this  
Followers 0
michcio

Does the "_IsPressed " function pause?

4 posts in this topic

#1 ·  Posted (edited)

I've made a short script that's using _IsPressed, Beep and some whiles:

#Include <Misc.au3>
While True
    press("5A", 261.63)
    press("53", 277.18)
WEnd

Func press($name, $freq)
    While _IsPressed($name)
        Beep($freq,100)
        
    WEnd
EndFunc

but while running it and holding down "s" or "z" it seems like the beep sound pauses like 1 ms between each beep :S...why is that? It couldn't be that it takes 1 ms to run through 2 while loops :S right?

thankfull for answers

michcio

Edited by michcio

Share this post


Link to post
Share on other sites



I've made a short script that's using _IsPressed, Beep and some whiles:

#Include <Misc.au3>
 While True
     press("5A", 261.63)
     press("53", 277.18)
 WEnd
 
 Func press($name, $freq)
     While _IsPressed($name)
         Beep($freq,100)
         
     WEnd
 EndFunc

but while running it and holding down "s" or "z" it seems like the beep sound pauses like 1 ms between each beep :S...why is that? It couldn't be that it takes 1 ms to run through 2 while loops :S right?

thankfull for answers

michcio

I think you will find the same if you had

while 1

instead of

While _IsPressed.

It's just the way beep works rather than anything else.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I think you will find the same if you had

while 1

instead of

While _IsPressed.

It's just the way beep works rather than anything else.

yes it's the same thing as I change it to while 1...weird :)...isn't there a way to fix it so when a button is hold it'll beep until it's released...aren't there for example any _IsClicked _isReleased functions??

Share this post


Link to post
Share on other sites

there is primaryup and primarydown.... can't remember right now what the actually variables are called.. i don't have the helpfile handy

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