Scripting Help

Ask gaming related questions (AHK v1.1 and older)
JustARegularGuy
Posts: 6
Joined: 16 Jan 2018, 12:26

Scripting Help

21 Jan 2018, 12:36

Good Morning Ladies and Gentlemen!

Can someone tell me what I am doing wrong in this script? I am trying to make this work in a non-active window selecting F keys for particular functions. Starting by pushing the F3 key, single instant, the only key that needs to be held down, is the F4 key at the end for 10min. I need this whole function to work on a continuous loop. Please see below.

If WinExist("ahk_exe BingBong.exe")
setKeyDelay, 10, 10
setMouseDelay, 10

^q::
Loop
{
Send {F3 down}
Sleep 100
Send {F3 Up}
Sleep 100
Send {F6 Down}
Sleep 100
Send {F6 Up}
Sleep 100
Send {F8 Down}
Sleep 100
Send {F8 Up}
Sleep 100
Send {F10 Down}
Sleep 100
Send {F10 Up}
Sleep 100
Send {F11 Down}
Sleep 100
Send {F11 Up}
Sleep 100
Send {F12 Down}
Sleep 100
Send {F12 Up}
Sleep 100
Send {F4 Down}
Sleep 10000 ;------If I am understanding right, this will hold the F4 key down for 10min?
Send {F4 up}
Sleep 100
}
Return
; all loops should have some emergency pause, suspend or exit key
Esc::
Pause
User avatar
Spawnova
Posts: 554
Joined: 08 Jul 2015, 00:12
Contact:

Re: Scripting Help

21 Jan 2018, 13:12

1 second == 1,000 milliseconds
therefore, 10 minutes == 1,000 * 60 = 60,000 * 10 = 600,000ms

assuming your program accepts controlsend, this should work for you, sending keystrokes to a background window.

Code: Select all

global procName := "BingBong.exe"

^q:: ;control q
loop {
	sendInactive("F3")
	sendInactive("F6")
	sendInactive("F8")
	sendInactive("F10")
	sendInactive("F11")
	sendInactive("F12")
	sendInactive("F4",600000)
}
return

esc::pause


sendInactive(key,delay=100) {
	ControlSend,,{%key% down}, ahk_exe %procName%
	sleep 100
	ControlSend,,{%key% up}, ahk_exe %procName%
	sleep delay
}

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 37 guests