Page 1 of 1

Suggestions to enhance a simple AHK script

Posted: 19 Sep 2017, 14:38
by guerilla
So I have this AHK code that runs in loop all time.

Code: Select all

Loop {
	
	IfWinActive, Adobe Flash Player 23
	{
		PixelGetColor, graycolor, 895, 347
		PixelGetColor, home, 1071, 302
		PixelGetColor, classicon, 912, 309
		PixelGetColor, hpcolor, 930, 347
		PixelGetColor, hpcolor2, 980, 347
		PixelGetColor, hpcolor3, 1020, 347
		PixelGetColor, hpcolor4, 1050, 347
		PixelGetColor, hpcolor5, 1075, 347
		PixelGetColor, hpendcolor, 1077, 347
		PixelGetColor, hppot, 940, 570
		if (graycolor = 0x363636) and (hpcolor2 = 0x545454) and (hpcolor3 = 0x545454){
			if (hppot = 0x0C0C0C) and (home= 0x070707)
			{
				Send F
				Sleep 100
			}
			else if (home= 0x070707)
			{
				Send R
			}
		}
	}
}
This basically checks my HP constantly and send R whenever it goes below some pixel. This works fine but it's very slow during execution. I believe there can be a better way since I am new with AHK and I know only limited functionalities.Any suggestions/improvements?

Thanks!