Hello. I need a script that can hold key 1 (not numpad), but after a certain time (for example, 100 milliseconds) would release.
Ideally, a structure like this:
I click on the key J, and the key 1 is held down for 100 ms, and so that the action can be repeated.
Is that possible?
Holding the key for a time
-
- Posts: 3
- Joined: 22 Jun 2021, 11:57
Re: Holding the key for a time
Code: Select all
j::
Send {1 down}
Sleep 100
Send {1 up}
return
Re: Holding the key for a time
Code: Select all
j::
send {1 down}
sleep 100
send {1 up}
return
Edit: I was slower. I noticed that autorepeat does not work, so I looked in the documentation. It's explained there
Re: Holding the key for a time
Thanks for your help! But this is a bit different from what I wanted. I wanted the key to be holded for a 100 millisecond for example, but not just pressed with 100 milliseconds sleepgrantmartin2002 wrote:Code: Select all
j:: Send {1 down} Sleep 100 Send {1 up} return
Re: Holding the key for a time
for example PRESSING is 1. holding is 1111111111111111111111
Re: Holding the key for a time
Hallo,
then perhaps:
then perhaps:
Code: Select all
j::
SendMode, Event
SetKeyDelay,, 20
Loop, 5
Send, {1 Down}
Send, {1 Up}
Return
Re: Holding the key for a time
thank you, working! how can i set the key hold time?Rohwedder wrote: Hallo,
then perhaps:Code: Select all
j:: SendMode, Event SetKeyDelay,, 20 Loop, 5 Send, {1 Down} Send, {1 Up} Return
Re: Holding the key for a time
Key hold time is (approximately) the product of Count and PressDuration.
Code: Select all
j:: ;key hold time ≈ Count * PressDuration
T := A_TickCount ;only for test
SendMode, Event
SetKeyDelay,, 20 ;PressDuration = 20ms
Loop, 5 ;Count = 5
Send, {1 Down}
Send, {1 Up}
ToolTip,% A_TickCount - T "ms" ;only for test
Return
Who is online
Users browsing this forum: Theda and 139 guests