AutoHotkey Community

It is currently May 27th, 2012, 4:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: October 9th, 2005, 4:33 am 
Offline

Joined: October 6th, 2005, 7:25 am
Posts: 24
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")
...


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 9th, 2005, 5:04 am 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 9th, 2005, 10:30 am 
Offline

Joined: October 6th, 2005, 7:25 am
Posts: 24
and Input can't be made to check for a key up even with something like this?
Input dummyVar, T0.03, {Down up}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 9th, 2005, 6:42 pm 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 9th, 2005, 8:24 pm 
Offline

Joined: October 6th, 2005, 7:25 am
Posts: 24
Just trying to learn the different uses for all the functions. Thanks for the help.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 78 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group