Help making pixel color change

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
tarantules
Posts: 3
Joined: 24 Sep 2016, 09:30

Help making pixel color change

14 Dec 2017, 10:02

Hello.
I want to make a script that will scan the entire monitor aeria and find only the pixels that didn't change color for a specific time (i.e 10min) and turn it black or white for 1 or 2 seconds.
To help you better I want to prevent the image retention on OLED tv when I use it as a PC monitor.
Thanks
User avatar
boiler
Posts: 16900
Joined: 21 Dec 2014, 02:44

Re: Help making pixel color change

14 Dec 2017, 14:36

This would require you to have two huge arrays (millions of elements each) for both storing the color and time of last change for every pixel on your screen. It will be very slow loop through every pixel -- much longer than 10 minutes -- mainly because getting the pixel color is such a slow operation and there millions of pixels. Then you'd need to draw pixels in black or white on a transparent GUI covering the screen and keep track of the ones that were drawn (another huge array) so you can go erase them a couple seconds later, or just wait on each one, and at 2 seconds each that will make the process take a ton longer once it starts drawing pixels. It will take a lot of CPU time, and it would probably interfere (visually at least) with things a good bit.

You would be much better off just having a script black out (or white out) the screen for a couple of seconds every 10 minutes.
tarantules
Posts: 3
Joined: 24 Sep 2016, 09:30

Re: Help making pixel color change

15 Dec 2017, 02:30

Even that it would be great and do the job...
User avatar
boiler
Posts: 16900
Joined: 21 Dec 2014, 02:44

Re: Help making pixel color change

15 Dec 2017, 07:23

This will alternate between a putting up a black window and white window that covers the screen every 10 minutes. It also moves the mouse so it doesn't show up when blacked (or whited) out, and then moves it back where it was.

Code: Select all

CoordMode, Mouse, Screen
Gui, -Caption

loop
{
	Sleep, 1000 * 60 * 10 ; 10 minutes
	MouseGetPos, MX, MY
	MouseMove, A_ScreenWidth, A_ScreenHeight, 0 ; move mouse off screen
	Gui, Color, % (Toggle := !Toggle ? "Black" : "White")
	Gui, Show, Maximize
	Sleep, 2000
	Gui, Hide
	MouseMove, MX, MY, 0 ; move mouse back
}
return
Edit: Correction to MouseMove speed
Last edited by boiler on 15 Dec 2017, 10:49, edited 1 time in total.
tarantules
Posts: 3
Joined: 24 Sep 2016, 09:30

Re: Help making pixel color change

15 Dec 2017, 10:37

Thanks a lot for your help.This will do the work just fine.
Thanks again.
User avatar
boiler
Posts: 16900
Joined: 21 Dec 2014, 02:44

Re: Help making pixel color change

15 Dec 2017, 10:51

You're welcome. You might want to use the version that I just edited because I noticed I didn't put the 0 speed (fastest) on one of the MouseMove commands. Probably not even noticeable, though.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: fiendhunter, xask1 and 239 guests