active window

Ask gaming related questions (AHK v1.1 and older)
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

active window

19 Apr 2021, 08:52

i have this script how i can make it work only inside a window

Code: Select all

loop {
		PixelSearch,,, 340, 62, 340, 62, 0xA00415, 100
if (!ErrorLevel = 0)

{
    Send {F2}
sleep 100
send {f2}
	}
}
return

F10::exitapp
[Mod edit: [code][/code] tags added.]
User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: active window

19 Apr 2021, 09:31

You can try ControlSend if you want to send to an inactive window. To do that, you might also need to change the CoordMode. If you instead want to toggle the loop, you can use WinWaitActive.
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: active window

19 Apr 2021, 09:52

sorry man im trying to learn but im new on scripts and i have no idea how to do that
User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: active window

19 Apr 2021, 09:54

Perhaps you can provide a short description of what you want to happen.
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: active window

19 Apr 2021, 10:04

i just want to that script works on a desired game emulator called Memu
because when i go use other things like google chrome or anything else the scripts keeps working outside of Memu
User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: active window

19 Apr 2021, 10:25

Ideas are below. Some windows do not respond to ControlSend.

Code: Select all

wTitle = Memu
Loop {
 WinWait, %wTitle%
 SetTimer, Memu, 300
 SoundBeep, 1800
 WinWaitClose
 SetTimer, Memu, Off
 SoundBeep, 1000
}
Memu:
SoundBeep, 1500
PixelSearch,,, 340, 62, 340, 62, 0xA00415, 100
If !ErrorLevel ; Skip if pixel was found
 Return
SetKeyDelay, 100
ControlSend,, {F2 2}, %wTitle%
Return
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: active window

19 Apr 2021, 10:35

why you added some beeps its working but those beeps lol
User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: active window

19 Apr 2021, 10:49

Feel free to remove the beeps! :)
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: active window

19 Apr 2021, 10:50

remove the beeps please
User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: active window

19 Apr 2021, 10:51

You would delete the SoundBeep lines.
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: active window

19 Apr 2021, 10:56

i did that but the script now not working anymore
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: active window

19 Apr 2021, 10:57

nvm my fault its working now thx man hugs

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Lamron750 and 90 guests