close autohotkey if mozilla or google chrome is not on

Ask gaming related questions
alberto
Posts: 3
Joined: 10 Apr 2018, 08:57

close autohotkey if mozilla or google chrome is not on

10 Apr 2018, 10:17

how can i add here if mozilla or google chrome is not open autohotkey to be closed
Loop {

ImageSearch, Px, Py, 577, 70, 670, 135, C:\Users\panf\Desktop\MAn\here.png
If ErrorLevel = 0
{
sleep,20
Send {8}
sleep,20
Send {2}
sleep,20
sleep,20
Send {2}
sleep,20
Send {escape}
sleep,20


sleep,20
Send {8}
sleep,20
Send {2}
sleep,20
sleep,20
Send {2}
sleep,20
Send {escape}
sleep,20


sleep,20
Send {8}
sleep,20
Send {2}
sleep,20
sleep,20
Send {2}
sleep,20
Send {escape}
sleep,20


sleep,20
Send {8}
sleep,20
Send {2}
sleep,20
sleep,20
Send {2}
sleep,20
Send {escape}
sleep,20

sleep,20
Send {8}
sleep,20
Send {2}
sleep,20
sleep,20
Send {2}
sleep,20
Send {escape}
sleep,20

}

return


0::pause
swagfag
Posts: 4036
Joined: 11 Jan 2017, 17:59

Re: close autohotkey if mozilla or google chrome is not on

10 Apr 2018, 13:38

Code: Select all

SetTimer, monitorFirefoxChrome, 100
monitorFirefoxChrome() {
	if !(WinExist("ahk_exe firefox.exe") && WinExist("ahk_exe chrome.exe")) {
		ExitApp
	}
}

Loop {
	ImageSearch, Px, Py, 577, 70, 670, 135, C:\Users\panf\Desktop\MAn\here.png
	if (ErrorLevel = 0) {
		Loop, 5 {
			Sleep, 20
			Send, {8}
			Sleep, 20
			Send, {2}
			Sleep, 40
			Send, {2}
			Sleep, 20
			Send, {Escape}
			Sleep, 20
		}
	}
}

return

0::pause ; look into other ways of suspending execution
alberto
Posts: 3
Joined: 10 Apr 2018, 08:57

Re: close autohotkey if mozilla or google chrome is not on

10 Apr 2018, 15:54

swagfag wrote:

Code: Select all

SetTimer, monitorFirefoxChrome, 100
monitorFirefoxChrome() {
	if !(WinExist("ahk_exe firefox.exe") && WinExist("ahk_exe chrome.exe")) {
		ExitApp
	}
}

Loop {
	ImageSearch, Px, Py, 577, 70, 670, 135, C:\Users\panf\Desktop\MAn\here.png
	if (ErrorLevel = 0) {
		Loop, 5 {
			Sleep, 20
			Send, {8}
			Sleep, 20
			Send, {2}
			Sleep, 40
			Send, {2}
			Sleep, 20
			Send, {Escape}
			Sleep, 20
		}
	}
}

return

0::pause ; look into other ways of suspending execution
Thanks alot can you make and one for osbuddy.jar is java if osbuddy is not open to close that ahk script thanks:D


SetTimer, monitorjavaw, 100
monitorFirefoxChrome() {
if !(WinExist("ahk_exe OBSuddy.jar") && WinExist("ahk_exe OBSuddy.jar")) {
ExitApp
}
}

Loop {
ImageSearch, Px, Py, 1, 1, 2000, 2000, C:\Users\Nicki\Desktop\off.PNG
if (ErrorLevel = 0) {
Loop, 5 {
Sleep, 20
Send, {8}
Sleep, 20
Send, {2}
Sleep, 40
Send, {2}
Sleep, 20
Send, {Escape}
Sleep, 20
}
}
}

return

0::pause ; look into other ways of suspending execution
swagfag
Posts: 4036
Joined: 11 Jan 2017, 17:59

Re: close autohotkey if mozilla or google chrome is not on

10 Apr 2018, 16:51

no idea what OBsuddy.jar is. if it launches an application most likely javaw.exe will be spawned, otherwise check using WinTitle

Code: Select all

SetTimer, monitorApplications, 100
monitorApplications() {
	if !(WinExist("ahk_exe firefox.exe") && WinExist("ahk_exe chrome.exe") && WinExist("ahk_exe javaw.exe")) {
		ExitApp
	}
}

Return to “Gaming”

Who is online

Users browsing this forum: MrTurett, ryanburnsninja and 14 guests