WideBoyDixon Posted March 23, 2009 Share Posted March 23, 2009 (edited) I thought this might be useful for aligning controls etc. or checking alignment on, for example, a web page (or a document). Actually, I'm not sure how it might be used but I'll dump it here anyway It uses rectangular regions to create a crosshair on the screen which follows the mouse. Fine tuning can be done with the arrow keys and pressing shift at the same time moves the crosshair in bigger increments. You can change $CROSSHAIR_SIZE and $BIG_MOVE to change the size of the "gap" in the crosshair (1 is the minimum) and also the size of the "jump" when shift is pressed down with the arrow keys. I ended up constantly updating the zoom window as otherwise it got corrupted when I tried to only update it when the mouse moved. If someone can find a better way or can find a use for this script then please amend away! I guess you could also change the color of the crosshair by setting a different background colour. expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) HotKeySet("{ESC}", "_ExitApplication") Global $SIZEX = 256, $SIZEY = 256, $CROSSHAIR_SIZE = 1, $BIG_MOVE = 8 Global $GUIZoom = GUICreate("Zoom", $SIZEX, $SIZEY, 0, 0, BitOR($WS_SYSMENU, $WS_BORDER, $WS_CAPTION), $WS_EX_TOPMOST) GUISetBkColor(0xEEEEEE) GUISetState() Global $Crosshair = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0x000000) GUISetState() Global $z1 = 4 Global $zoomX = Int($SIZEX / $z1), $zoomY = Int($SIZEY / $z1), $DeskDC = _WinAPI_GetDC(0), $MyDC = _WinAPI_GetDC($GUIZoom) _WinAPI_SetBkMode($MyDC, 1) Global $UserDLL = DllOpen("user32.dll") Global $bLocked = False, $bContinue = True, $aPos, $aLast[2] = [-1, -1], $aMask, $aM_Mask, $nInc _SetZoom() While $bContinue If ($aLast[0] <> -1) Then $nInc = 1 If _IsPressed("10", $UserDLL) Then $nInc = $BIG_MOVE If _IsPressed("25", $UserDLL) Then MouseMove($aLast[0] - $nInc, $aLast[1]) If _IsPressed("27", $UserDLL) Then MouseMove($aLast[0] + $nInc, $aLast[1]) If _IsPressed("26", $UserDLL) Then MouseMove($aLast[0], $aLast[1] - $nInc) If _IsPressed("28", $UserDLL) Then MouseMove($aLast[0], $aLast[1] + $nInc) EndIf $aPos = MouseGetPos() If _IsPressed("4C", $UserDLL) Then $bLocked = Not $bLocked Do Sleep(10) Until Not _IsPressed("4C", $UserDLL) EndIf If _IsPressed("21", $UserDLL) And $z1 < 32 Then $z1 *= 2 _SetZoom() Do Sleep(10) Until Not _IsPressed("21", $UserDLL) $aLast[0] = -1 EndIf If _IsPressed("22", $UserDLL) And $z1 > 1 Then $z1 /= 2 _SetZoom() Do Sleep(10) Until Not _IsPressed("22", $UserDLL) $aLast[0] = -1 EndIf If ($aPos[0] <> $aLast[0]) Or ($aPos[1] <> $aLast[1]) Then If (Not $bLocked) Then $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", $aPos[1], "long", $aPos[0] + 1 - $CROSSHAIR_SIZE, "long", $aPos[1] + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPos[0], "long", 0, "long", $aPos[0] + 1, "long", $aPos[1] + 1 - $CROSSHAIR_SIZE) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPos[0] + $CROSSHAIR_SIZE, "long", $aPos[1], "long", @DesktopWidth, "long", $aPos[1] + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPos[0], "long", $aPos[1] + $CROSSHAIR_SIZE, "long", $aPos[0] + 1, "long", @DesktopHeight) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $Crosshair, "long", $aM_Mask[0], "int", 1) $aLast = $aPos EndIf EndIf _WinAPI_StretchBlt($MyDC, 0, 0, $SIZEX, $SIZEY, $DeskDC, $aPos[0] - ($zoomX / 2), $aPos[1] - ($zoomY / 2), $zoomX, $zoomY, $SRCCOPY) Sleep(50) WEnd GUISetState(@SW_HIDE, $Crosshair) GUISetState(@SW_HIDE, $GUIZoom) GUIDelete($Crosshair) GUIDelete($GUIZoom) DllClose($UserDLL) Exit Func OnAutoItExit() _WinAPI_ReleaseDC(0, $DeskDC) _WinAPI_ReleaseDC($GUIZoom, $MyDC) EndFunc ;==>OnAutoItExit Func _SetZoom() _WinAPI_SetWindowText($GUIZoom, "Crosshair- x" & $z1) $zoomX = Int($SIZEX / $z1) $zoomY = Int($SIZEY / $z1) EndFunc ;==>_SetZoom Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iROP) Local $aResult = DllCall("GDI32.dll", "int", "StretchBlt", "hwnd", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidth, "int", $iHeight, _ "hwnd", $hSrcDC, "int", $iXSrc, "int", $iYSrc, "int", $iWidthSrc, "int", $iHeightSrc, "int", $iROP) If @error Then Return SetError(@error, 0, False) Return $aResult[0] <> 0 EndFunc ;==>_WinAPI_StretchBlt Func _ExitApplication() $bContinue = False EndFunc ;==>_ExitApplication Have fun. WBD Edited March 24, 2009 by WideBoyDixon robertocm 1 [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
billthecreator Posted March 24, 2009 Share Posted March 24, 2009 Thats pretty neat. [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
AlmarM Posted March 24, 2009 Share Posted March 24, 2009 Very nice! AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
WideBoyDixon Posted March 24, 2009 Author Share Posted March 24, 2009 Thanks for the comments. I just edited the first post with a new script which allows you to press "L" to lock the crosshair in place. Pressing "L" again unlocks it. WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
Angoth Posted March 24, 2009 Share Posted March 24, 2009 Very cool. I made a slight modification to your script to suit my needs. I needed to map out screen coords X,Y for apps to click and check contents. I deleted the Zoom display on the GUI title bar and added a check, display and GUI title bar update for the mouse coords in the While...Wend. It's still 99.99999999999999999% your code. Thanks. I needed that, badly. expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) HotKeySet("{ESC}", "_ExitApplication") Global $SIZEX = 256, $SIZEY = 256, $CROSSHAIR_SIZE = 1, $BIG_MOVE = 8 Global $GUIZoom = GUICreate("Zoom", $SIZEX, $SIZEY, 0, 0, BitOR($WS_SYSMENU, $WS_BORDER, $WS_CAPTION), $WS_EX_TOPMOST) GUISetBkColor(0xEEEEEE) GUISetState() Global $Crosshair = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0x000000) GUISetState() Global $z1 = 4 Global $zoomX = Int($SIZEX / $z1), $zoomY = Int($SIZEY / $z1), $DeskDC = _WinAPI_GetDC(0), $MyDC = _WinAPI_GetDC($GUIZoom) _WinAPI_SetBkMode($MyDC, 1) Global $UserDLL = DllOpen("user32.dll") Global $bLocked = False, $bContinue = True, $aPos, $aLast[2] = [-1, -1], $aMask, $aM_Mask, $nInc _SetZoom() While $bContinue If ($aLast[0] <> -1) Then $nInc = 1 If _IsPressed("10", $UserDLL) Then $nInc = $BIG_MOVE If _IsPressed("25", $UserDLL) Then MouseMove($aLast[0] - $nInc, $aLast[1]) If _IsPressed("27", $UserDLL) Then MouseMove($aLast[0] + $nInc, $aLast[1]) If _IsPressed("26", $UserDLL) Then MouseMove($aLast[0], $aLast[1] - $nInc) If _IsPressed("28", $UserDLL) Then MouseMove($aLast[0], $aLast[1] + $nInc) EndIf $aPos = MouseGetPos() If _IsPressed("4C", $UserDLL) Then $bLocked = Not $bLocked Do Sleep(10) Until Not _IsPressed("4C", $UserDLL) EndIf If _IsPressed("21", $UserDLL) And $z1 < 32 Then $z1 *= 2 _SetZoom() Do Sleep(10) Until Not _IsPressed("21", $UserDLL) $aLast[0] = -1 EndIf If _IsPressed("22", $UserDLL) And $z1 > 1 Then $z1 /= 2 _SetZoom() Do Sleep(10) Until Not _IsPressed("22", $UserDLL) $aLast[0] = -1 EndIf If ($aPos[0] <> $aLast[0]) Or ($aPos[1] <> $aLast[1]) Then If (Not $bLocked) Then $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", $aPos[1], "long", $aPos[0] + 1 - $CROSSHAIR_SIZE, "long", $aPos[1] + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPos[0], "long", 0, "long", $aPos[0] + 1, "long", $aPos[1] + 1 - $CROSSHAIR_SIZE) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPos[0] + $CROSSHAIR_SIZE, "long", $aPos[1], "long", @DesktopWidth, "long", $aPos[1] + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPos[0], "long", $aPos[1] + $CROSSHAIR_SIZE, "long", $aPos[0] + 1, "long", @DesktopHeight) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $Crosshair, "long", $aM_Mask[0], "int", 1) $aLast = $aPos EndIf EndIf _WinAPI_StretchBlt($MyDC, 0, 0, $SIZEX, $SIZEY, $DeskDC, $aPos[0] - ($zoomX / 2), $aPos[1] - ($zoomY / 2), $zoomX, $zoomY, $SRCCOPY) Sleep(50) $aPos = MouseGetPos() _WinAPI_SetWindowText($GUIZoom, "X = " & $aPos[0] & " Y = " & $aPos[1]) WEnd GUISetState(@SW_HIDE, $Crosshair) GUISetState(@SW_HIDE, $GUIZoom) GUIDelete($Crosshair) GUIDelete($GUIZoom) DllClose($UserDLL) Exit Func OnAutoItExit() _WinAPI_ReleaseDC(0, $DeskDC) _WinAPI_ReleaseDC($GUIZoom, $MyDC) EndFunc ;==>OnAutoItExit Func _SetZoom() _WinAPI_SetWindowText($GUIZoom, "Crosshair- x" & $z1) $zoomX = Int($SIZEX / $z1) $zoomY = Int($SIZEY / $z1) EndFunc ;==>_SetZoom Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iROP) Local $aResult = DllCall("GDI32.dll", "int", "StretchBlt", "hwnd", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidth, "int", $iHeight, _ "hwnd", $hSrcDC, "int", $iXSrc, "int", $iYSrc, "int", $iWidthSrc, "int", $iHeightSrc, "int", $iROP) If @error Then Return SetError(@error, 0, False) Return $aResult[0] <> 0 EndFunc ;==>_WinAPI_StretchBlt Func _ExitApplication() $bContinue = False EndFunc ;==>_ExitApplication Angoth Link to comment Share on other sites More sharing options...
AlmarM Posted March 24, 2009 Share Posted March 24, 2009 Very cool. I made a slight modification to your script to suit my needs. I needed to map out screen coords X,Y for apps to click and check contents. I deleted the Zoom display on the GUI title bar and added a check, display and GUI title bar update for the mouse coords in the While...Wend. It's still 99.99999999999999999% your code. Thanks. I needed that, badly. expandcollapse popup...oÝ÷ Ø à¢Øªê-y.r¥uëÞ§]rh«¢+Ø¥¹±Õ±Ðí ½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíU% ½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíU% ½¹ÍѹÑÍà¹ÔÌÐì(¥¹±Õ±Ðí5¥Í¹ÔÌÐì(¥¹±Õ±Ðí]¥¹A$¹ÔÌÐì(¥¹±Õ±Ðí]¥¹½ÝÍ ½¹ÍѹÑ̹ÔÌÐì()=ÁÐ ÅÕ½Ðí5ÕÍѱÉYÉÌÅÕ½Ðì°Ä¤()!½Ñ-åMÐ ÅÕ½ÐííM ôÅÕ½Ðì°ÅÕ½Ðí}á¥ÑÁÁ±¥Ñ¥½¸ÅÕ½Ðì¤()±½°ÀÌØíM%i`ôÈÔØ°ÀÌØíM%idôÈÔØ°ÀÌØí I=MM!%I}M%iôÄ°ÀÌØí %}5=Yôà)±½°ÀÌØíU%i½½´ôU% ÉÑ ÅÕ½Ðíi½½´ÅÕ½Ðì°ÀÌØíM%i`°ÀÌØíM%id°À°À° ¥Ñ=H ÀÌØí]M}MeM59T°ÀÌØí]M} =IH°ÀÌØí]M} AQ%=8¤°ÀÌØí]M}a}Q=A5=MP¤)U%MÑ ½±½È Áá¤)U%MÑMÑÑ ¤)±½°ÀÌØí ɽÍÍ¡¥ÈôU% ÉÑ ÅÕ½ÐìÅÕ½Ðì°ÍѽÁ]¥Ñ °ÍѽÁ!¥¡Ð°À°À°ÀÌØí]M}A=AU@°ÀÌØí]M}a}Q==1]%9=¬ÀÌØí]M}a}Q=A5=MP¤)U%MÑ ½±½È ÁàÀÀÀÀÀÀ¤)U%MÑMÑÑ ¤()±½°ÀÌØíèÄôÐ)±½°ÀÌØíé½½µ`ô%¹Ð ÀÌØíM%i`¼ÀÌØíèĤ°ÀÌØíé½½µdô%¹Ð ÀÌØíM%id¼ÀÌØíèĤ°ÀÌØíÍô}]¥¹A%}Ñ À¤°ÀÌØí5åô}]¥¹A%}Ñ ÀÌØíU%i½½´¤)}]¥¹A%}MÑ 5½ ÀÌØí5å°Ä¤)±½°ÀÌØíUÍÉ10ô±±=Á¸ ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì¤)±½°ÀÌØí1½ô±Í°ÀÌØí ½¹Ñ¥¹ÕôQÉÕ°ÀÌØíA½Ì°ÀÌØí ½±½È°ÀÌØí1ÍÑlÉtôl´Ä°´Åt°ÀÌØí5ͬ°ÀÌØí5}5ͬ°ÀÌØí¹%¹()}MÑi½½´ ¤)]¡¥±ÀÌØí ½¹Ñ¥¹Õ(% ÀÌØí1ÍÑlÁt±ÐìÐì´Ä¤Q¡¸(ÀÌØí¹%¹ôÄ(%}%ÍAÉÍÍ ÅÕ½ÐìÄÀÅÕ½Ðì°ÀÌØíUÍÉ10¤Q¡¸ÀÌØí¹%¹ôÀÌØí %}5=Y(%}%ÍAÉÍÍ ÅÕ½ÐìÈÔÅÕ½Ðì°ÀÌØíUÍÉ10¤Q¡¸5½ÕÍ5½Ù ÀÌØí1ÍÑlÁt´ÀÌØí¹%¹°ÀÌØí1ÍÑlÅt¤(%}%ÍAÉÍÍ ÅÕ½ÐìÈÜÅÕ½Ðì°ÀÌØíUÍÉ10¤Q¡¸5½ÕÍ5½Ù ÀÌØí1ÍÑlÁt¬ÀÌØí¹%¹°ÀÌØí1ÍÑlÅt¤(%}%ÍAÉÍÍ ÅÕ½ÐìÈØÅÕ½Ðì°ÀÌØíUÍÉ10¤Q¡¸5½ÕÍ5½Ù ÀÌØí1ÍÑlÁt°ÀÌØí1ÍÑlÅt´ÀÌØí¹%¹¤(%}%ÍAÉÍÍ ÅÕ½ÐìÈàÅÕ½Ðì°ÀÌØíUÍÉ10¤Q¡¸5½ÕÍ5½Ù ÀÌØí1ÍÑlÁt°ÀÌØí1ÍÑlÅt¬ÀÌØí¹%¹¤(¹%(ÀÌØíA½Ìô5½ÕÍÑA½Ì ¤(%}%ÍAÉÍÍ ÅÕ½ÐìÑÅÕ½Ðì°ÀÌØíUÍÉ10¤Q¡¸(ÀÌØí1½ô9½ÐÀÌØí1½(¼(M±À ÄÀ¤(U¹Ñ¥°9½Ð}%ÍAÉÍÍ ÅÕ½ÐìÑÅÕ½Ðì°ÀÌØíUÍÉ10¤(¹%(%}%ÍAÉÍÍ ÅÕ½ÐìÈÄÅÕ½Ðì°ÀÌØíUÍÉ10¤¹ÀÌØíèıÐìÌÈQ¡¸(ÀÌØíèĨôÈ(}MÑi½½´ ¤(¼(M±À ÄÀ¤(U¹Ñ¥°9½Ð}%ÍAÉÍÍ ÅÕ½ÐìÈÄÅÕ½Ðì°ÀÌØíUÍÉ10¤(ÀÌØí1ÍÑlÁtô´Ä(¹%(%}%ÍAÉÍÍ ÅÕ½ÐìÈÈÅÕ½Ðì°ÀÌØíUÍÉ10¤¹ÀÌØíèÄÐìÄQ¡¸(ÀÌØíèļôÈ(}MÑi½½´ ¤(¼(M±À ÄÀ¤(U¹Ñ¥°9½Ð}%ÍAÉÍÍ ÅÕ½ÐìÈÈÅÕ½Ðì°ÀÌØíUÍÉ10¤(ÀÌØí1ÍÑlÁtô´Ä(¹%(% ÀÌØíA½ÍlÁt±ÐìÐìÀÌØí1ÍÑlÁt¤=È ÀÌØíA½ÍlÅt±ÐìÐìÀÌØí1ÍÑlÅt¤Q¡¸(%¡9½ÐÀÌØí1½¤Q¡¸(ÀÌØí5}5ͬô±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ÉÑIÑI¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°À°ÅÕ½Ðí±½¹ÅÕ½Ðì°À°ÅÕ½Ðí±½¹ÅÕ½Ðì°À°ÅÕ½Ðí±½¹ÅÕ½Ðì°À¤(ÀÌØí5ͬô±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ÉÑIÑI¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°À°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÅt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÁt¬Ä´ÀÌØí I=MM!%I}M%i°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÅt¬Ä¤(±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ½µ¥¹I¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°È¤(ÀÌØí5ͬô±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ÉÑIÑI¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°À°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÁt¬Ä°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÅt¬Ä´ÀÌØí I=MM!%I}M%i¤(±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ½µ¥¹I¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°È¤(ÀÌØí5ͬô±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ÉÑIÑI¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÁt¬ÀÌØí I=MM!%I}M%i°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÅt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÍѽÁ]¥Ñ °ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÅt¬Ä¤(±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ½µ¥¹I¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°È¤(ÀÌØí5ͬô±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ÉÑIÑI¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÅt¬ÀÌØí I=MM!%I}M%i°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíA½ÍlÁt¬Ä°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÍѽÁ!¥¡Ð¤(±± ±° ÅÕ½Ðí¤Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½Ðí ½µ¥¹I¸ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5ÍlÁt°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°È¤(±± ±° ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½ÐíMÑ]¥¹½ÝI¸ÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØí ɽÍÍ¡¥È°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí5}5ÍlÁt°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°Ä¤(ÀÌØí1ÍÐôÀÌØíA½Ì(¹%(¹%(}]¥¹A%}MÑÉÑ¡ ±Ð ÀÌØí5å°À°À°ÀÌØíM%i`°ÀÌØíM%id°ÀÌØíÍ°ÀÌØíA½ÍlÁt´ ÀÌØíé½½µ`¼È¤°ÀÌØíA½ÍlÅt´ ÀÌØíé½½µd¼È¤°ÀÌØíé½½µ`°ÀÌØíé½½µd°ÀÌØíMI =Ad¤(M±À ÔÀ¤(ÀÌØíA½Ìô5½ÕÍÑA½Ì ¤($ÀÌØí ½±½ÈôA¥á±Ñ ½±½È ÀÌØíA½ÍlÁt°ÀÌØíA½ÍlÅt¤(}]¥¹A%}MÑ]¥¹½ÝQáÐ ÀÌØíU%i½½´°ÅÕ½Ðí`èÅÕ½ÐìµÀìÀÌØíA½ÍlÁtµÀìÅÕ½ÐìdèÅÕ½ÐìµÀìÀÌØíA½ÍlÅtµÀìÅÕ½Ðì ½±½ÈèÅÕ½ÐìµÀìÅÕ½ÐìÁàÅÕ½ÐìµÀì!à ÀÌØí ½±½È°Ø¤¤)]¹()U%MÑMÑÑ¡M]}!%°ÀÌØí ɽÍÍ¡¥È¤)U%MÑMÑÑ¡M]}!%°ÀÌØíU%i½½´¤)U%±Ñ ÀÌØí ɽÍÍ¡¥È¤)U%±Ñ ÀÌØíU%i½½´¤)±± ±½Í ÀÌØíUÍÉ10¤()á¥Ð()Õ¹=¹Õѽ%Ñá¥Ð ¤(}]¥¹A%}I±Í À°ÀÌØíͤ(}]¥¹A%}I±Í ÀÌØíU%i½½´°ÀÌØí5å¤)¹Õ¹ìôôÐí=¹Õѽ%Ñá¥Ð()Õ¹}MÑi½½´ ¤(}]¥¹A%}MÑ]¥¹½ÝQáÐ ÀÌØíU%i½½´°ÅÕ½Ðí ɽÍÍ¡¥È´àÅÕ½ÐìµÀìÀÌØíèĤ(ÀÌØíé½½µ`ô%¹Ð ÀÌØíM%i`¼ÀÌØíèĤ(ÀÌØíé½½µdô%¹Ð ÀÌØíM%id¼ÀÌØíèĤ)¹Õ¹ìôôÐí}MÑi½½´()Õ¹}]¥¹A%}MÑÉÑ¡ ±Ð ÀÌØí¡ÍÑ°ÀÌØí¥aÍаÀÌØí¥eÍаÀÌØí¥]¥Ñ °ÀÌØí¥!¥¡Ð°ÀÌØí¡MÉ°ÀÌØí¥aMÉ°ÀÌØí¥eMÉ°ÀÌØí¥]¥Ñ¡MÉ°ÀÌØí¥!¥¡ÑMÉ°ÀÌØí¥I=@¤(1½°ÀÌØíIÍÕ±Ðô±± ±° ÅÕ½Ðí$Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMÑÉÑ¡ ±ÐÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØí¡ÍÑ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥aÍаÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥eÍаÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥]¥Ñ °ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥!¥¡Ð°|(ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØí¡MÉ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥aMÉ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥eMÉ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥]¥Ñ¡MÉ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥!¥¡ÑMÉ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥I=@¤(%ÉɽÈQ¡¸IÑÕɸMÑÉɽȡÉɽȰÀ°±Í¤(IÑÕɸÀÌØíIÍÕ±ÑlÁt±ÐìÐìÀ)¹Õ¹ìôôÐí}]¥¹A%}MÑÉÑ¡ ±Ð()Õ¹}á¥ÑÁÁ±¥Ñ¥½¸ ¤(ÀÌØí ½¹Ñ¥¹Õô±Í)¹Õ¹ìôôÐí}á¥ÑÁÁ±¥Ñ¥½ AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Mat Posted March 24, 2009 Share Posted March 24, 2009 Funky lil script! Does anyone know how I could edit this to make the crosshair stick on click, and for a second one to be created, also on click? I've played around with the script fo the last hour with no success. I also need it to return the 2 xy coords.... MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
WideBoyDixon Posted March 25, 2009 Author Share Posted March 25, 2009 Something like this?: expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) HotKeySet("{ESC}", "_ExitApplication") Global $SIZEX = 256, $SIZEY = 256, $CROSSHAIR_SIZE = 1, $BIG_MOVE = 8 Global $GUIZoom = GUICreate("Zoom", $SIZEX, $SIZEY, 0, 0, BitOR($WS_SYSMENU, $WS_BORDER, $WS_CAPTION), $WS_EX_TOPMOST) GUISetBkColor(0xEEEEEE) GUISetState() Global $Crosshair = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0x000000) GUISetState() Global $z1 = 4 Global $zoomX = Int($SIZEX / $z1), $zoomY = Int($SIZEY / $z1), $DeskDC = _WinAPI_GetDC(0), $MyDC = _WinAPI_GetDC($GUIZoom) _WinAPI_SetBkMode($MyDC, 1) Global $UserDLL = DllOpen("user32.dll") Global $iCurrent = 0, $bContinue = True, $aPos, $aColor, $aLast[2] = [-1, -1], $aMask, $aM_Mask, $nInc, $aPoints[2][2] = [[-1, -1], [-1, -1]], $i _SetZoom() While $bContinue $bContinue = (GUIGetMsg() <> $GUI_EVENT_CLOSE) If ($aLast[0] <> -1) Then $nInc = 1 If _IsPressed("10", $UserDLL) Then $nInc = $BIG_MOVE If _IsPressed("25", $UserDLL) Then MouseMove($aLast[0] - $nInc, $aLast[1]) If _IsPressed("27", $UserDLL) Then MouseMove($aLast[0] + $nInc, $aLast[1]) If _IsPressed("26", $UserDLL) Then MouseMove($aLast[0], $aLast[1] - $nInc) If _IsPressed("28", $UserDLL) Then MouseMove($aLast[0], $aLast[1] + $nInc) EndIf $aPos = MouseGetPos() If $iCurrent < 2 Then $aPoints[$iCurrent][0] = $aPos[0] $aPoints[$iCurrent][1] = $aPos[1] EndIf If _IsPressed("01", $UserDLL) Then If $iCurrent < 2 Then ToolTip("[" & $aPoints[$iCurrent][0] & "," & $aPoints[$iCurrent][1] & "]", $aPoints[$iCurrent][0], $aPoints[$iCurrent][1]) EndIf $iCurrent += 1 If $iCurrent > 2 Then $iCurrent = 0 Do Sleep(10) Until Not _IsPressed("01", $UserDLL) $aLast[0] = -1 EndIf If _IsPressed("21", $UserDLL) And $z1 < 32 Then $z1 *= 2 _SetZoom() Do Sleep(10) Until Not _IsPressed("21", $UserDLL) $aLast[0] = -1 EndIf If _IsPressed("22", $UserDLL) And $z1 > 1 Then $z1 /= 2 _SetZoom() Do Sleep(10) Until Not _IsPressed("22", $UserDLL) $aLast[0] = -1 EndIf If ($aPos[0] <> $aLast[0]) Or ($aPos[1] <> $aLast[1]) Then $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) For $i = 0 To 1 If $aPoints[$i][0] >= 0 Then $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", $aPoints[$i][1], "long", $aPoints[$i][0] + 1 - $CROSSHAIR_SIZE, "long", $aPoints[$i][1] + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPoints[$i][0], "long", 0, "long", $aPoints[$i][0] + 1, "long", $aPoints[$i][1] + 1 - $CROSSHAIR_SIZE) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPoints[$i][0] + $CROSSHAIR_SIZE, "long", $aPoints[$i][1], "long", @DesktopWidth, "long", $aPoints[$i][1] + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $aPoints[$i][0], "long", $aPoints[$i][1] + $CROSSHAIR_SIZE, "long", $aPoints[$i][0] + 1, "long", @DesktopHeight) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) EndIf Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $Crosshair, "long", $aM_Mask[0], "int", 1) $aLast = $aPos EndIf _WinAPI_StretchBlt($MyDC, 0, 0, $SIZEX, $SIZEY, $DeskDC, $aPos[0] - ($zoomX / 2), $aPos[1] - ($zoomY / 2), $zoomX, $zoomY, $SRCCOPY) Sleep(50) $aPos = MouseGetPos() $aColor = PixelGetColor($aPos[0], $aPos[1]) _WinAPI_SetWindowText($GUIZoom, "X: " & $aPos[0] & " Y: " & $aPos[1] & " Color: " & "0x" & Hex($aColor, 6)) WEnd GUIDelete($Crosshair) GUIDelete($GUIZoom) DllClose($UserDLL) Exit Func OnAutoItExit() _WinAPI_ReleaseDC(0, $DeskDC) _WinAPI_ReleaseDC($GUIZoom, $MyDC) EndFunc ;==>OnAutoItExit Func _SetZoom() $zoomX = Int($SIZEX / $z1) $zoomY = Int($SIZEY / $z1) EndFunc ;==>_SetZoom Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iROP) Local $aResult = DllCall("GDI32.dll", "int", "StretchBlt", "hwnd", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidth, "int", $iHeight, _ "hwnd", $hSrcDC, "int", $iXSrc, "int", $iYSrc, "int", $iWidthSrc, "int", $iHeightSrc, "int", $iROP) If @error Then Return SetError(@error, 0, False) Return $aResult[0] <> 0 EndFunc ;==>_WinAPI_StretchBlt Func _ExitApplication() $bContinue = False EndFunc ;==>_ExitApplication WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
Mat Posted March 25, 2009 Share Posted March 25, 2009 Yep thats good thanks, I'll be able to play around with that now and turn it into something I can use!! thanks a lot WideBoyDixon!! MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
KaFu Posted April 17, 2009 Share Posted April 17, 2009 (edited) Nice script . Anyone tested in on Vista already? Heard that COP (which also utilizes the gdi32.dll) does have problems on Vista. Edited April 17, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 17, 2009 Moderators Share Posted April 17, 2009 All, Works on my Vista x32 Sp1 HP. Although it does flicker a bit and it occasionally misses the mouse clicks. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KaFu Posted April 17, 2009 Share Posted April 17, 2009 Thanks for the feedback , maybe it's time for another COP update ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
JSThePatriot Posted April 17, 2009 Share Posted April 17, 2009 Love the script...could have used this a while back, saved in my archive now for future use if I so have a need. Thanks again, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Skrip Posted April 18, 2009 Share Posted April 18, 2009 I like it! [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
tonycst Posted May 10, 2018 Share Posted May 10, 2018 I get error "C:\Users\Administrator\Desktop\ARK DOT.au3"(109,128) : error: _WinAPI_StretchBlt() already defined running any of the examples above. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 10, 2018 Moderators Share Posted May 10, 2018 tonycst, Running code from 9 years ago I am surprised you do not get more errors! _WinAPI_StretchBlt is now one of the standard AutoIt includes - as a quick glance at the Help file would have told you - so you no longer need it defined as a separate function in the script. Delete those few lines and the example works fine - for me at least. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now