pausing ahk when out of a game Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Scars_Lover
Posts: 1
Joined: 18 Jan 2018, 10:37
Contact:

pausing ahk when out of a game

18 Jan 2018, 10:43

i just copied this rapid fire script and added the function to stop ahk script when i'm out of rainbow six, but adding this code makes the code don't working.

here's the code:

Code: Select all

setKeyDelay, 50, 50
setMouseDelay, 50

$~lbutton::
	while (getKeyState("lbutton", "P"))
	{
		send, {lbutton}
		sleep, 40
	}

#IfWinActive, ahk_class Notepad

return
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: pausing ahk when out of a game  Topic is solved

18 Jan 2018, 21:27

See if this works for you.

Code: Select all

#SingleInstance, Force
SendMode, Event

settitlematchmode,2 ;<- so you don't need the whole nopad window title
detecthiddenwindows On ;<- so the script can detect the target window even if hidden
return

esc:: ;<- exits the script entirely
	tooltip ;<- turns off the tooltip message
	MsgBox,0x1000,Line%A_LineNumber%,Script Ended. ;<- signals the end of the script
	ExitApp

;------------------------------------------------
; make sure the game is in windows mode so
; it shows a title bar on the screen. Change
; the tgtwin variable to reflect the game's
; displayed title from the titlebar. this routine
; does not exit the script, it simply stops the
; loop until the game window can become active
; again. It's been tested with the windows
; Notepad so i know it works with that
; window
;------------------------------------------------
$~lbutton::
	Suspend Permit
	tgtwin := "Rainbow Six"
	;tgtwin := "Untitled"
	while (getKeyState("lbutton", "P"))
	{	ifWinNotActive, %tgtwin% ;<- check the target window
		{	break ;<- break the loop if window is not active
		}
		click
		sleep, 40
	}
	return
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 73 guests