Need help combining/setting same hotkey for two scripts Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ahrixiwnl
Posts: 4
Joined: 16 Jan 2018, 00:37

Need help combining/setting same hotkey for two scripts

16 Jan 2018, 00:43

Hey! So, total AHK newb here. I have two scripts, one to hold down shift and one to hold down W. I was wodnering if I could have some help combining them and setting the toggle to the same key. Thanks!
First code-

Code: Select all

P::
{
KeyDown2 := !KeyDown2
If KeyDown2
	Send {shift down}
Else
	Send {shift up}
Return
}

{::
second code-

Code: Select all

[::
{
KeyDown2 := !KeyDown2
If KeyDown2
	Send {w down}
Else
	Send {w up}
Return
}

q::
Thanks in advance! -Ahrix
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help combining/setting same hotkey for two scripts

16 Jan 2018, 02:48

Hallo,
try:

Code: Select all

OnExit, ExitSub
*p::
ShiftDown := !ShiftDown
If ShiftDown
	Send {shift down}
Else
	Send {shift up}
Return
*[::
WDown := !WDown
If WDown
	Send {w down}
Else
	Send {w up}
Return
ExitSub:
	Send {shift up}{w up}
ExitApp
ahrixiwnl
Posts: 4
Joined: 16 Jan 2018, 00:37

Re: Need help combining/setting same hotkey for two scripts

16 Jan 2018, 02:50

Thank you so much! I will try it out now!
ahrixiwnl
Posts: 4
Joined: 16 Jan 2018, 00:37

Re: Need help combining/setting same hotkey for two scripts

16 Jan 2018, 02:52

Is there any way to set both binds to the same key? Meaning when I press one key it starts both of them. Thanks!
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help combining/setting same hotkey for two scripts  Topic is solved

16 Jan 2018, 03:22

Hallo,
try:

Code: Select all

OnExit, ExitSub
*p::
P := !P
If P
	Send {shift down}{w down}
Else
	Send {shift up}{w up}
Return
ExitSub:
	Send {shift up}{w up}
ExitApp
but I do not think you know exactly what you want!
ahrixiwnl
Posts: 4
Joined: 16 Jan 2018, 00:37

Re: Need help combining/setting same hotkey for two scripts

16 Jan 2018, 11:33

Thats perfect! Thank you so much!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 208 guests