Jump to content

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

Press-hold-release


  • Please log in to reply
4 replies to this topic
Verdil
  • Members
  • 2 posts
  • Last active: Sep 11 2009 03:04 PM
  • Joined: 11 Sep 2009
Hello
I'm trying to write a script that would work like this:
When I press and hold key "a" I send letters "b" and "c" but only once. Then, releasing key "a" i send letter "d".
So after holding key "a" pressed for a certain amount of time i would get "bcd".


It's probably something like this.
a::
    {
      send b
      send c
    }
return

a Up::send .
The problem is that this script keeps on printing "bc" many times, when I hold "a" pressed and I would like to print it just once.

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
a::
 send b
 send c
return

a Up::
send d
Return

That should do what you want. You might want to look at KeyHistory to see if your keyboard is causing this (multiple typematic keypresses).

You could also add $ to the two hotkeys to make sure nothing else can activate it.

Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009
a::

 send b

 send c

 keywait,a

return



a Up::

 send d

Return


Verdil
  • Members
  • 2 posts
  • Last active: Sep 11 2009 03:04 PM
  • Joined: 11 Sep 2009
Oh yeah, Leef_me, thats it, thank you very much. I didn't think it would be so easy though.

Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009

I didn't think it would be so easy though.

Easy :p Easy :cry:
I'm sitting in gallons of blood, sweat, and tears, and Verdil says 'Easy' :cry:

Oh yeah, Leef_me, thats it, thank you very much

You're very welcome. But most of the credit goes to engunneer

Thanks engunneer