AutoHotkey Community

It is currently May 27th, 2012, 5:17 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: January 7th, 2011, 2:02 pm 
Offline

Joined: May 14th, 2009, 6:47 pm
Posts: 5
Hi guys. I'm trying to make a script that activates only if a special key is pressed down for longer than 5 seconds. I can't make the script activate when the key is pressed down, only on release.

This is what I've come up with for now:
Code:
#InstallKeybdHook

SC121 Down::
  Time := A_TickCount
  KeyWait, SC121, Up
  {
  Time2 := A_TickCount
  }
  Time3 := Time2 - Time
  TrayTip, Tittel, Test:  %Time3%
  SetTimer, RemoveTrayTip, 3000
  Return


But %time3% is 0 every time instead of counting the amount of time the special key has been pressed down. Any ideas? =)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2011, 4:36 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
It's possible that your keyboard never registers that key as being held down and instantly follows the 'down' message with an 'up' message.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], XstatyK, Yahoo [Bot] and 75 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