I've been really satisfied with the basic hotkeys I made, but I'm trying to do more complicated stuff. They should still be really basic stuff for you guys. I'm not sure if it is possible to do this.
when I press ` key (This is just an example, it can be other keys),
Press {C}
{Shift Down}
Wait for my left click, and when I left click,
{Shift Up}
Press {P}
I am having a hard time figuring out the wait for my left click part.
I would appreciate your help. Thanks!
Beginner Question About Keywait(?) Topic is solved
Re: Beginner Question About Keywait(?)
You have to use the D option for it to wait for it to pressed down, otherwise it only waits for its release, which is its normal (non-pressed) state:
Code: Select all
KeyWait, LButton, D
Last edited by boiler on 05 Dec 2021, 08:57, edited 1 time in total.
Re: Beginner Question About Keywait(?)
Code: Select all
`::
on := True
Send c{Shift down}
KeyWait, ``
SoundBeep, 1000
Return
#If on
+LButton Up::
SoundBeep, 1500
Send {Shift up}p
on := False
~::
Return
#If
Re: Beginner Question About Keywait(?)
Thank you so much for the help!mikeyww wrote: ↑05 Dec 2021, 08:57Code: Select all
`:: on := True Send c{Shift down} KeyWait, `` SoundBeep, 1000 Return #If on +LButton Up:: SoundBeep, 1500 Send {Shift up}p on := False ~:: Return #If
Re: Beginner Question About Keywait(?)
Thank you so much for the help!boiler wrote: ↑05 Dec 2021, 08:57You have to use the D option for it to wait for it to pressed down, otherwise it only waits for its release, which is its normal (non-pressed) state:Code: Select all
KeyWait, LButton, D
That "D" made it works perfectly, but I have to ask two more questions.
Code: Select all
`::
Send c{Shift down}
KeyWait, Lbutton, D
Send, p{Shift Up}
Return
And, how would I put Lbutton, D "or" Rbutton, D? I forgot to mention that I could press left-click or right-click in the first question.
Thanks again!
Re: Beginner Question About Keywait(?) Topic is solved
Maybe it’s a timing issue of being too close after the click or something. See if adding something like Sleep, 100 in between helps.
That requires a very different solution. Perhaps this post will help.
Re: Beginner Question About Keywait(?)
Yes, it was a timing issue. I didn't release the left click quick enough, so the "sleep" made everything work well.
Thank you!
Re: Beginner Question About Keywait(?)
Actually, this is even better than a Sleep because it waits for the button to pressed and released before sending the p:
Code: Select all
`::
Send c{Shift down}
KeyWait, Lbutton, D
KeyWait, Lbutton
Send, p{Shift Up}
Return
Re: Beginner Question About Keywait(?)
Wow, that's amazing! That works very clean. Thanks!boiler wrote: ↑05 Dec 2021, 13:15Actually, this is even better than a Sleep because it waits for the button to pressed and released before sending the p:Code: Select all
`:: Send c{Shift down} KeyWait, Lbutton, D KeyWait, Lbutton Send, p{Shift Up} Return