Alright, so i decided to make a pixel color getter in AHK, similar to
Instant Eyedropper but that would work on both screens, and be triggerable via hotkey (having the drag the thing all the way across the screen is annoying).
Basically it creates a grid (5x5, progress controls) and updates them to the pixels around your cursor. and has a text box of the one under your cursor.
But i ran into somewhat of a problem...
It's painfully slow, updating at around once a second.
I ran into
this topic and modified it slightly.
Code:
Start := A_TickCount
count = 26
Loop, %count%
PixelGetColor, var, 1, 1,alt
end := A_TickCount
MsgBox % count " PixelGetColor calls took " (end - Start) "ms (" (end - start)/count "ms each)"
exitapp
Heres what i got:
26 PixelGetColor calls took 812ms (31.230769ms each)
200 PixelGetColor calls took 5865ms (29.325000ms each)
1000 PixelGetColor calls took 28595ms (28.595000ms each)
I'm on Quad Core AMD 64bit, 4gigs of ram, so thats not the problem. Is it possible its a vista thing? Could some other people try the code up there and give me your results? Also here is my current version if you want to check it out. (clipboard features not added yet)
Code:
#singleinstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
coordmode,pixel,screen
coordmode,mouse,screen
gui,color,EEEEEE
gui,margin,0,0
gui,-caption +alwaysontop
loop, 5 {
i := A_index
loop, 5 {
j := A_index
x := 10*i -9
y := 10*j -9
gui, add, progress, w10 h10 x%x% y%y% vPixel%i%%j% backgroundRed
}
}
gui,add,progress,w7 h1 x22 y25 backgroundBlack vc1
gui,add,progress,w1 h7 x25 y22 backgroundBlack vc2
guicontrol,+backgroundBlue,pixel33
gui,font,s14,
gui,add,text,x60 y15 vtext,#EEEEEEEE
gui,show,,ColorFinder
loop {
mousegetpos,mx,my
if (mx=lastx && my=lasty) {
sleep 50
continue
}
lastx := mx
lasty := my
;now lets do the pixels
loop, 5 {
i := A_index
loop, 5 {
j := A_index
pixelgetcolor,color,% mx -3 + i ,% my -3+j,RGB
guicontrol, +background%color%, Pixel%i%%j%
}
}
pixelgetcolor,color,%mx%,%my%,RGB
stringtrimleft,color,color,2
guicontrol,,text,#%color%
guicontrol,movedraw, c1,w7
guicontrol,movedraw,c2,h7
guix := mx + 20
guiy := my - 25
gui,show,NA x%guix% y%guiy% w160 h52
}
return
Edit: I also tried SetBatchLines, -1 and it didn't seem to help,
as suggested in this thread.
_________________
"Power can be given overnight, but responsibility must be taught. Long years go into its making."