Page 1 of 1

multiple hotkeys wont work?

Posted: 21 Aug 2023, 07:30
by ravena1
help please im having issue running multiple hotkey in one script
so i had to make seperate script from it
is there any way to make it work in one script??

Code: Select all

1::
blooming()
return

2::
divider()
return

3::
cyclone()
return




blooming()
{
Send, {w Down}{RButton Down}
sleep, 20
Send, {w up}{RButton up}
sleep, 20
Send, {Shift Down}{LButton Down}{RButton Down}
sleep, 70
Send, {Shift up}{LButton up}{RButton up}
sleep, 150
Send, {LButton Down}
sleep, 30
Send, {LButton up}

return
}


divider()
{
Send, {w Down}{RButton Down}
sleep, 20
Send, {w up}{RButton up}
sleep, 20
Send, {Shift Down}{LButton Down}{RButton Down}
sleep, 70


return
}


cyclone()
{
Send, {w Down}{RButton Down}
sleep, 10
Send, {w up}{RButton up}
sleep, 20
Send, {LButton Down}{RButton Down}
sleep, 200
Send, {LButton up}{RButton up}
sleep, 160
Send, {LButton Down}
sleep, 60
Send, {LButton up}


return
}



end::exitapp

Re: multiple hotkeys wont work?

Posted: 21 Aug 2023, 07:42
by mikeyww
It works, but only one subroutine runs at a time. You can combine them into one. You could use variables to indicate which actions should occur in a unified approach. If divider() leaves some buttons down, then remember that they will be down!

A hotkey to be triggered when Shift is down would need a + or * hotkey modifier, or would need to specify the shifted key.

Code: Select all

#Requires AutoHotkey v1.1.33

1::
+1::
Send 2
Return
Or:

Code: Select all

#Requires AutoHotkey v1.1.33

1::
!::
Send 2
Return