It is possible to modify the code to work in an inactive window or screen, but it will depend on how the inactive window or screen is implemented and what you want the code to do.
To modify the code to work in an inactive window, you will need to specify the window handle of the inactive window and use the Window command to specify that the PixelSearch and Click actions should be performed on the inactive window.
For example, you could use the WinGet command to retrieve the window handle of the inactive window and store it in a variable, and then use the Window command to specify that the PixelSearch and Click actions should be performed on the inactive window:
WinGet, hwnd, ID, ahk_class [class name] Window, %hwnd% CoordMode, Pixel, Window PixelSearch, FoundX, FoundY, 0, 0, 1280, 1024, 0x00FF90, 30, Fast RGB If ErrorLevel = 0 Click, %FoundX%, %FoundY%, 1 Sleep, 500 Click, 137, 96, Left, 1 Sleep, 500
To modify the code to work on an inactive screen, you will need to use a different approach, such as using a screen capture tool to capture an image of the inactive screen and then performing image processing on the captured image to search for the pixel with the specified color. This will require additional programming skills and may be more complex to implement.
I hope this helps! Let me know if you have any questions or need further assistance.