Running a script in a unactive window(?) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
JavierBO
Posts: 14
Joined: 08 Jul 2019, 05:43

Running a script in a unactive window(?)

19 Aug 2019, 22:44

Is it possible to run a script in a unactive window?
The following code checks for a specific color in the active window and if the color is not found it presses Page Up.
The pixel would be changing constantly even if the window is not focused.
What I want is for the script to keeping checking for that said pixelcolor in a set window even if it's not my current folder/program maximized(focused) and send the PageUp in the set window.

Example:

Code: Select all

!^l::
#MaxThreadsPerHotkey 1
if KeepWinZRunning
{
    KeepWinZRunning := false
    return
}
; Otherwise:
KeepWinZRunning := true
Loop
{
	
			PixelSearch, Px, Py, 1133, 320, 1244, 338, 0x508BB0, 3, Fast
			if (Errorlevel = 1){
			Send, {PgUp}
			Sleep, 2025
			}
			
    if not KeepWinZRunning
        break
}
KeepWinZRunning := false
return

!l::
Pause
User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Running a script in a unactive window(?)

20 Aug 2019, 00:46

Hi,
PixelSearch is limited to what's visible on the screen. The window doesn't have to be active, but it has to be visible.
If that's the case, you could send keystrokes to that window via ControlSend.
:eh: :think:
JavierBO
Posts: 14
Joined: 08 Jul 2019, 05:43

Re: Running a script in a unactive window(?)

20 Aug 2019, 15:50

Sir Teddy the First wrote: Hi,
PixelSearch is limited to what's visible on the screen. The window doesn't have to be active, but it has to be visible.
If that's the case, you could send keystrokes to that window via ControlSend.
is it possible if i use a different type of check?
User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Running a script in a unactive window(?)  Topic is solved

21 Aug 2019, 01:28

What kind of window/program are we talking about.
Maybe something like ControlGetText would also work.

If not, have a look at this thread, I think that's what you were looking for in the first place.
:eh: :think:
JavierBO
Posts: 14
Joined: 08 Jul 2019, 05:43

Re: Running a script in a unactive window(?)

21 Aug 2019, 17:32

Sir Teddy the First wrote: What kind of window/program are we talking about.
Maybe something like ControlGetText would also work.

If not, have a look at this thread, I think that's what you were looking for in the first place.
i'll look into that thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Ragnar and 151 guests