AutoHotkey Community

It is currently May 27th, 2012, 1:12 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: May 22nd, 2008, 12:11 pm 
Offline

Joined: April 29th, 2008, 9:32 pm
Posts: 13
Hello,

I'm new to AutoHotkey. A fantastic tool !

What is the method to fire an action when left click is hold down for one second ?

I know how tu use a timer. But how can I evaluate if the left click is hold down ?

Thanks for your help.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2008, 12:55 pm 
Offline

Joined: May 5th, 2008, 1:11 pm
Posts: 22
Check the GetKeyState help


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 23rd, 2008, 12:43 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
Code:
LButton::
Sleep, 1000
If !(GetKeyState("LButton", "P")
return
 ;add your actions here
return


This should work fine unless you happen to click your mouse exactly one second after the initial clicking, in which case it will still think you held it down.

There are better ways of doing this, but this is the simplest and should work almost all the time.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Amandaville, Bing [Bot], BrandonHotkey, chaosad, Google [Bot] and 22 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