; 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]
Zoomer magnifier
Started by
Watcher
, Feb 14 2005 05:48 AM
5 replies to this topic
#1
-
Posted 14 February 2005 - 05:48 AM
Great stuff !
I've tested it.
Btw: Great stuff !!
Thx for sharing it
Little tweak. Use the Forums code option to label your code as code. :wink:
I've tested it.
Btw: Great stuff !!
Thx for sharing it
Little tweak. Use the Forums code option to label your code as code. :wink:
#2
-
Posted 14 February 2005 - 09:19 AM
yeah this is nice!
#3
-
Posted 14 February 2005 - 09:30 AM
CleanNews.in : Bite sized latest news headlines from India with zero bloat
Sorry didn't work for me. Running Window XP Home SP3
#4
-
Posted 19 January 2010 - 02:09 PM
The script works fine for me on XP Pro SP3 but keep in mind this script is very outdated. This technique has been improved upon, for example, in toralf's AHK Window Info script.
Make sure that you're using the latest version of AHK.
Make sure that you're using the latest version of AHK.
#5
-
Posted 19 January 2010 - 04:01 PM
My edited version of "color zoomer". A plugin for my personal 'Mango' script.
- no color selector
- zoom out with -
- zoom in with =
- escape with Esc
- re-positions so it doesn't go off-screen
- no color selector
- zoom out with -
- zoom in with =
- escape with Esc
- re-positions so it doesn't go off-screen
; Mango: Magnifier ; Creator: Sean (Color Zoomer) ; Modified: tidbit ; Version: 1.10 CoordMode, ToolTip, Screen ToolTip, ( - --- Zoom out = --- Zoom in Esc --- Exit ) , 0, 0 #NoEnv #SingleInstance, Force SetWinDelay, 10 CoordMode, Mouse DetectHiddenWindows, On SetTimer, RemovetoolTip, 8000 ; very bottom of script Zoomer() Return -::Return =::Return ~Esc::ExitApp Zoomer() { nZ := 3 ; Zoom Factor nR := 256//2//nZ*nZ - 1 ; Rectangle of the Zoomer VarSetCapacity(nColor,63) nColor := A_Space VarSetCapacity(ti, 40, 0) ti := Chr(40) DllCall("ntdll\RtlFillMemoryUlong", "Uint", &ti + 4, "Uint", 4, "Uint", 0x20) DllCall("ntdll\RtlFillMemoryUlong", "Uint", &ti +36, "Uint", 4, "Uint", &nColor) hWnd := DllCall("CreateWindowEx", "Uint", 0x08000008, "str", "tooltips_class32", "str", "", "Uint", 0x3, "int", 0, "int", 0, "int", 0, "int", 0, "Uint", 0, "Uint", 0, "Uint", 0, "Uint", 0) DllCall("SetClassLong", "Uint", hWnd, "int", -12, "int", DllCall("LoadCursor", "Uint", 0, "Uint", 32515)) SendMessage, 1028, 0, &ti,, ahk_id %hWnd% SendMessage, 1041, 1, &ti,, ahk_id %hWnd% SendMessage, 1036, 0, &ti,, ahk_id %hWnd% hDC_SC := DllCall("GetDC", "Uint", 0) hDC_TT := DllCall("GetDC", "Uint", hWnd) Loop { MouseGetPos, xCursor, yCursor DllCall("StretchBlt", "Uint", hDC_TT, "int", 0, "int", 0, "int", 2*nR, "int", 2*nR, "Uint", hDC_SC, "int", xCursor-nR//nZ, "int", yCursor-nR//nZ, "int", 2*nR//nZ, "int", 2*nR//nZ, "Uint", 0x00CC0020) if (xCursor>=A_ScreenWidth//2) xcurpos:=xCursor-(nR+1)-(nR+5) Else xcurpos:=xCursor-(nR+1)+(nR+5) if (yCursor>=A_ScreenHeight//2) ycurpos:=yCursor-(nR+1)-(nR+5) Else ycurpos:=yCursor-(nR+1)+(nR+5) WinMove, ahk_id %hWnd%,, xcurpos, ycurpos, 2*(nR+1), 2*(nR+1) ; 1-pixel border WinSet, AlwaysOnTop, On, ahk_id %hWnd% ; WinMove, ahk_id %hWnd%,, xCursor-(nR+1)+(nR+5), yCursor-(nR+1)-(nR+5), 2*(nR+1), 2*(nR+1) ; 1-pixel border If GetKeyState("=") { nZ+=1 sleep, 200 } If GetKeyState("-") { nZ-=1 sleep, 200 } } } Cursor(hDC, xCenter, yCenter) { VarSetCapacity(mi, 20, 0) mi := Chr(20) DllCall("GetCursorInfo", "Uint", &mi) ptr := &mi + 4 bShow := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24 hCursor := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24 DllCall("GetIconInfo", "Uint", hCursor, "Uint", &mi) ptr := &mi + 4 xHotspot := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24 yHotspot := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24 hBMMask := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24 hBMColor := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24 DllCall("DeleteObject", "Uint", hBMMask) DllCall("DeleteObject", "Uint", hBMColor) If bShow DllCall("DrawIcon", "Uint", hDC, "int", xCenter - xHotspot, "int", yCenter - yHotspot, "Uint", hCursor) } RemovetoolTip: SetTimer, RemovetoolTip, Off Tooltip return
#6
-
Posted 19 January 2010 - 04:26 PM
rawr. be very afraid
*poke*
. Populate the AutoHotkey city. Pointless but somewhat fun. .