Need help for a Script to command 2 different things at once. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Zavar

Need help for a Script to command 2 different things at once.

21 Aug 2017, 04:21

New to this program and I need a script (That can be toggled on or off with F2.) that holds down the E key that also will Hold-left click for 2 seconds and then release and repeat.

So far I have found this online to hold down the E key:

F2::
KeyDown := !KeyDown
If KeyDown
SendInput {e down}
Else
SendInput {e up}
Return
Rohwedder
Posts: 7645
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help for a Script to command 2 different things at once.  Topic is solved

21 Aug 2017, 10:53

Hallo,
the script holds down the e key (permanent).
Also holds down LButton for 2 seconds, releases LButton and repeat.

Code: Select all

Pause
Loop
{
	If !GetKeyState("e") ;If the e key is up
		SendInput {e Down} ;press down permanent
	SendInput {LButton Down}
	Sleep, 2000
	SendInput {LButton Up}
}
Return
F2:: ;Key F2 toggles script on/off
	SendInput {e Up}{LButton Up}
	Pause,,1
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: blue_fields and 312 guests