AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can Input be substituted for KeyWait?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Peepsalot



Joined: 06 Oct 2005
Posts: 24

PostPosted: Sun Oct 09, 2005 3:33 am    Post subject: Can Input be substituted for KeyWait? Reply with quote

I was looking at the Input function, and it seems like it is capable of performing the same thing. I have a script that uses KeyWait, so I tried replacing it with a call to Input, but it isn't functioning the same. I don't understand what the difference is really.

original snippet of KeyWait code
Code:

  KeyWait Down, T0.03
  if (ErrorLevel)
...
 


Input code that doesn't work the same, and I don't know why:
Code:

  Input dummyVar, T0.03, {Down}
if (ErrorLevel="Timeout")
...
Back to top
View user's profile Send private message
shimanov



Joined: 25 Sep 2005
Posts: 610

PostPosted: Sun Oct 09, 2005 4:04 am    Post subject: Re: Can Input be substituted for KeyWait? Reply with quote

Code:

  KeyWait Down, T0.03
  if (ErrorLevel)
...
 


KeyWait by default waits for the key to be released (up). Therefore, there is not a timeout condition, but rather KeyWait returns with ErrorLevel = 0.

Code:

  Input dummyVar, T0.03, {Down}
if (ErrorLevel="Timeout")
...


Input waits for the key to be depressed (down). Therefore, there is a timeout condition if the key specified as an "EndKey" is not pressed.
Back to top
View user's profile Send private message
Peepsalot



Joined: 06 Oct 2005
Posts: 24

PostPosted: Sun Oct 09, 2005 9:30 am    Post subject: Reply with quote

and Input can't be made to check for a key up even with something like this?
Input dummyVar, T0.03, {Down up}
Back to top
View user's profile Send private message
shimanov



Joined: 25 Sep 2005
Posts: 610

PostPosted: Sun Oct 09, 2005 5:42 pm    Post subject: Reply with quote

Peepsalot wrote:
and Input can't be made to check for a key up even with something like this?
Input dummyVar, T0.03, {Down up}


No. Input is waiting for a key to be pressed. That is its behavior by design.

Why do you want to replace KeyWait with Input?
Back to top
View user's profile Send private message
Peepsalot



Joined: 06 Oct 2005
Posts: 24

PostPosted: Sun Oct 09, 2005 7:24 pm    Post subject: Reply with quote

Just trying to learn the different uses for all the functions. Thanks for the help.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group