Hi,
Is there any way to archive this:
While holding alt and press down send 1, but when i release alt, send 2.
I tried fiddling with keywait and getkeystate, but couldn't figure how to do this.
Thanks!
Need help with executing different code when modifier is released Topic is solved
Re: Need help with executing different code when modifier is released
Using a modifier alone on this is a bit weird, but you can try this:
Code: Select all
LAlt:: ; change to RAlt if you want right, or Alt if you want to try either
While GetKeyState("LAlt","P")
{
Send 1
Sleep 100
}
Send 2
return
Re: Need help with executing different code when modifier is released
Exaskryz wrote:Using a modifier alone on this is a bit weird, but you can try this:
Code: Select all
LAlt:: ; change to RAlt if you want right, or Alt if you want to try either While GetKeyState("LAlt","P") { Send 1 Sleep 100 } Send 2 return
Hi,
I tried this script and it sends 1 repeatedly while i hold alt, what i would like is to send 1 only when i press down button, while holding alt, then when i release alt, send 2.
Code: Select all
Alt & Down::
While GetKeyState("Alt","P")
{
Send 1
Sleep 100
}
Send 2
return
Re: Need help with executing different code when modifier is released
Oh, Down as in the Down Arrow. I see.
The hotkey can be changed to !Down:: because ! is the Alt modifier.
Do you mean it should repeat sending 1 and repeat sending 2? I would change Send 2 into
And it would end when you release Down.
The hotkey can be changed to !Down:: because ! is the Alt modifier.
Do you mean it should repeat sending 1 and repeat sending 2? I would change Send 2 into
Code: Select all
While GetKeyState("Down","P")
{
Send 2
Sleep 100
}
Re: Need help with executing different code when modifier is released
Sorry for not being clear enoughExaskryz wrote:Oh, Down as in the Down Arrow. I see.
The hotkey can be changed to !Down:: because ! is the Alt modifier.
Do you mean it should repeat sending 1 and repeat sending 2? I would change Send 2 into
And it would end when you release Down.Code: Select all
While GetKeyState("Down","P") { Send 2 Sleep 100 }
1. I press alt, then down button - 1 is sent for one time, not repeating.
2. Each time i press down button, while keeping alt button pressed down, 1 is sent.
3. Once i release alt button, 2 is sent.
Re: Need help with executing different code when modifier is released Topic is solved
I think this would work:
Now I've tested it.
The potential problem is that Alt will send 2 if you didn't even press Alt+Down. So you may use this untested code:
Code: Select all
!Down::Send 1
~Alt up::Send 2
The potential problem is that Alt will send 2 if you didn't even press Alt+Down. So you may use this untested code:
Code: Select all
!Down::Send 1
~Alt up::
If (A_PriorHotkey="!Down")
Send 2
return
Re: Need help with executing different code when modifier is released
It works!Exaskryz wrote:I think this would work:
Now I've tested it.Code: Select all
!Down::Send 1 ~Alt up::Send 2
The potential problem is that Alt will send 2 if you didn't even press Alt+Down. So you may use this untested code:
Code: Select all
!Down::Send 1 ~Alt up:: If (A_PriorHotkey="!Down") Send 2 return
Thanks
Who is online
Users browsing this forum: No registered users and 299 guests