Code:
; Written by Watcher aka Bill DeVos with, as always, help
; from the forums at www.autohotkey.com.
; This program was a small project to give me the ability
; to pick an individual pixel for another project. Simply
; put it gives you a zoomed view of the point that your
; cursor is on and the 24 pixles around it. AHK is probably
; not the best program to do this with, the screen flashes a
; bit but you can adjust the speed easily which helps.
; Oh, and Win-Q does the same as the Button and Win-W does the paste
Z_UpdateSpeed = 100 ; This is the default screen update speed
ZoomerOn = ; This sets Zoomer to off,
; it's started after the interface is created.
Gui, Add, Button, x6 y10 w80 h30 gButtonZoomer, Zoomer Off
Gui, Add, Progress, x4 y60 w30 h30 vPixel1, Pixel1
Gui, Add, Progress, x34 y60 w30 h30 vPixel2, Pixel2
Gui, Add, Progress, x64 y60 w30 h30 vPixel3, Pixel3
Gui, Add, Progress, x94 y60 w30 h30 vPixel4, Pixel4
Gui, Add, Progress, x124 y60 w30 h30 vPixel5, Pixel5
Gui, Add, Progress, x4 y90 w30 h30 vPixel6, Pixel6
Gui, Add, Progress, x34 y90 w30 h30 vPixel7, Pixel7
Gui, Add, Progress, x64 y90 w30 h30 vPixel8, Pixel8
Gui, Add, Progress, x94 y90 w30 h30 vPixel9, Pixel9
Gui, Add, Progress, x124 y90 w30 h30 vPixel10, Pixel10
Gui, Add, Progress, x4 y120 w30 h30 vPixel11, Pixel11
Gui, Add, Progress, x34 y120 w30 h30 vPixel12, Pixel12
Gui, Add, Progress, x64 y120 w30 h30 +Border vPixel13, Pixel13
GuiControl, Move, Pixel13, w31 h31
Gui, Add, Progress, x94 y120 w30 h30 vPixel14, Pixel14
Gui, Add, Progress, x124 y120 w30 h30 vPixel15, Pixel15
Gui, Add, Progress, x4 y150 w30 h30 vPixel16, Pixel16
Gui, Add, Progress, x34 y150 w30 h30 vPixel17, Pixel17
Gui, Add, Progress, x64 y150 w30 h30 vPixel18, Pixel18
Gui, Add, Progress, x94 y150 w30 h30 vPixel19, Pixel19
Gui, Add, Progress, x124 y150 w30 h30 vPixel20, Pixel20
Gui, Add, Progress, x4 y180 w30 h30 vPixel21, Pixel21
Gui, Add, Progress, x34 y180 w30 h30 vPixel22, Pixel22
Gui, Add, Progress, x64 y180 w30 h30 vPixel23, Pixel23
Gui, Add, Progress, x94 y180 w30 h30 vPixel24, Pixel24
Gui, Add, Progress, x124 y180 w30 h30 vPixel25, Pixel25
Gui, Show, x70 y50 w158 h207, Zoomer
Gui, +AlwaysOnTop +ToolWindow
Gosub ButtonZoomer
Return
GuiEscape:
GuiClose:
ExitApp
#w::
if ZoomerOn ; If Zoomer isn't On, don't set DoPaste flag.
DoPaste = 1
return
#q:: ; Cheap trick to have hotkey toggle Zoomer on/off
ButtonZoomer:
{
if ZoomerOn
{
ZoomerOn =
SetTimer, Zoomer, off
ControlSetText Zoomer, Zoomer On, Zoomer
Gosub RemoveToolTip
}
else
{
ZoomerOn = 1
SetTimer, Zoomer, %Z_UpdateSpeed%
ControlSetText Zoomer, Zoomer Off, Zoomer
}
return
}
RemoveToolTip:
{
SetTimer, RemoveToolTip, Off
ToolTip
return
}
Zoomer:
{
RangeX = -2,-1,0,1,2
RangeY = -2,-1,0,1,2
MouseGetPos, X, Y
PixelGetColor, PixelColor, X, Y, RGB
ToolTip X %X% Y %Y% C %PixelColor%
if DoPaste
{
DoPaste =
Clipboard = %X% %Y% %PixelColor%
}
Loopcount = 0
Loop Parse, RangeY, CSV
{
ParseY = %A_LoopField%
Loop Parse, RangeX, CSV
{
Loopcount += 1
ParseX = %A_LoopField%
PixelGetColor, PixelColor, (X + ParseX), (Y + ParseY), RGB
GuiControl +Background%PixelColor%, Pixel%Loopcount%
}
}
Return
}
[/code]