Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to check time since priorKey was last pressed?


  • Please log in to reply
2 replies to this topic
Tito
  • Members
  • 13 posts
  • Last active: Dec 14 2015 12:03 PM
  • Joined: 10 Nov 2012

Hi, 

 

So basically this is what I want to achieve:

 

- Whenever I press shift

     - Check if the previous key was 1

     - and shift was pressed 0.5secs after 1 was pressed

 

I tried writing my own script, it works, but doesnt for the last part where it checks for the 0.5secs.

I simply dont know how to check the time for priorKey

 

Any help is appreciated

~Shift::
{	
	if GetKeyState("Shift", "P") AND (A_PriorKey = "1")
      	Send {2 down}
	Sleep 50
	Send {2 up}
	Sleep 50
} 


Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

You can use A_TimeSincePriorHotKey and make a hotkey ~1::return

 

Also, of note, you may want to put the block around the Send and Sleep lines after the If. Otherwise only the first line will apply to the If command, and you'd always see the Sleep 50, Send {2 up}, and Sleep 50 lines execute no matter what the priorKey was.



Tito
  • Members
  • 13 posts
  • Last active: Dec 14 2015 12:03 PM
  • Joined: 10 Nov 2012

Cool thx, problem solved!