Jump to content



Photo

Mouse Location Pointer


  • Please log in to reply
9 replies to this topic

#1 Ealric

Ealric

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 16 April 2008 - 07:14 PM

EDIT: Changes

A small label that sits below your mouse that follows the cursor around. It gives exact screen coordinates if working solely on a desktop. If you work within any "active" client window, it will change coordinate options to match the current active window. This is useful if you want to find coordinates within any window or just with your desktop.

Traytooltip shows the name of the currently active window. If no active window, it defaults to "desktop".

When you press ALT + F it will create a color.txt file and enter the date, time, (x,y coords) and hex color of the point your mouse is on. It will continue to append for every alt+f press you make.

If you want to terminate the app, press Alt + ESC.

AutoIt         
#include <GuiConstants.au3> #include <date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Opt("GUIOnEventMode", 1) Opt("WinTitleMatchMode", 4) ; set title matchmode to advanced Global $xoffset = 37 Global $yoffset = 23 Global $wposx, $wposy, $DT, $cWIN, $xcalcL, $xcalcR, $ycalc, $cpos, $pos, $tpos, $hexV, $_color Global $title = "Your Title Here" HotKeySet("!{ESC}", "Terminate") ; a way out of this HotKeySet("!f", "_color"); check for color $pGUI = GUICreate($title, 150, 13, -1, -1, $WS_POPUP) $startLAB = GUICtrlCreateLabel(" X: 0000, Y: 0000, C: 000000000", 0, 0, 150, 13) GUICtrlSetBkColor($startLAB, 0xCCFFFF) WinSetOnTop($pGUI, "", 1) GUISetState(@SW_SHOW) While 1     _checkWIN()     _nMGP() WEnd Func _nMGP()     Sleep(0010)     $pos = MouseGetPos()     If not IsArray($pos) then return     $_color = PixelGetColor($pos[0],$pos[1])     GUICtrlSetData($startLAB, ' X: ' & $pos[0] & ', Y: ' & $pos[1] & ', C: ' & $_color)     If $DT = 1 Then         $xcalcR = .95 * @DesktopWidth         $xcalcL = .05 * @DesktopWidth         $ycalc = .90 * @DesktopHeight         If $pos[1] > $ycalc Then             $wposy = $pos[1] - $yoffset * 2 ; If too close to bottom of screen position above mouse pointer         Else             $wposy = $pos[1] + $yoffset ; Position label beneath the mouse pointer         EndIf         If $pos[0] > $xcalcR Then ; If too close to right side of screen move it             $wposx = $pos[0] - $xoffset * 3         ElseIf $pos[0] < $xcalcL Then ; If too close to left side of screen move it             $wposx = $pos[0] + 10         Else             $wposx = $pos[0] - $xoffset ; Use normal offsets for positioning label         EndIf     Else         _clientmouse()     EndIf     WinMove($title, "", $wposx, $wposy) ; Move the label appropriate to follow the mouse EndFunc   ;==>_nMGP Func _checkWIN()     $cWIN = WinGetTitle("[ACTIVE]")     If $cWIN <> $title Then         TrayTip("", $cWIN, 30)         Opt("MouseCoordMode", 0)         $DT = 0     Else         TrayTip("", "DESKTOP", 30)         Opt("MouseCoordMode", 1)         $DT = 1     EndIf EndFunc   ;==>_checkWIN Func _clientmouse()     Opt("MouseCoordMode", 1)     $tpos = MouseGetPos()     $_color = PixelGetColor($tpos[0],$tpos[1])     Global $cpos = WinGetPos($cWIN)     If not IsArray($cpos) then return     $xcalcR = .95 * $cpos[2]     $xcalcL = .05 * $cpos[2]     $ycalc = .90 * $cpos[3]     If $tpos[1] > $ycalc Then         $wposy = $tpos[1] - $yoffset * 2 ; If too close to bottom of screen position above mouse pointer     Else         $wposy = $tpos[1] + $yoffset ; Position label beneath the mouse pointer     EndIf     If $tpos[0] > $xcalcR Then ; If too close to right side of screen move it         $wposx = $tpos[0] - $xoffset * 3     ElseIf $tpos[0] < $xcalcL Then ; If too close to left side of screen move it         $wposx = $tpos[0] + 10     Else         $wposx = $tpos[0] - $xoffset ; Use normal offsets for positioning label     EndIf EndFunc   ;==>_clientmouse Func _color()     Local $_cpos = MouseGetPos()     Local $pcolor     $pcolor = PixelGetColor($_cpos[0],$_cpos[1])     $hexV = "0x" & Hex($pcolor,6)     Local $fOpen = FileOpen(@ScriptDir & "\color.txt",1)     FileWrite($fOpen,@CRLF & _NowDate() & " " & _NowTime() & " : " & "X: " & $_cpos[0] & _         "," & "Y: " & $_cpos[1] & " | " & "Hex: " & $hexV & " Color: " & $pcolor)     FileClose($fOpen) EndFunc Func Terminate()     Exit 0 EndFunc   ;==>Terminate


Example Output

CODE
2/11/2009 2:11:02 PM : X: 542,Y: 667 Hex: 0xFCFCFC Color: 16579836
2/11/2009 2:11:04 PM : X: 774,Y: 612 Hex: 0xFCFCFC Color: 16579836
2/11/2009 2:11:04 PM : X: 855,Y: 432 Hex: 0xE8F5FD Color: 15267325

Edited by Ealric, 11 February 2009 - 07:11 PM.








#2 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,078 posts

Posted 16 April 2008 - 07:31 PM

AutoIt         
#include <GuiConstantsEx.au3> Opt("MouseCoordMode", 1)        ;1=absolute, 0=relative, 2=client ******* Very Important ******** Global $ycalc = .90 * @DesktopHeight Global $Xcalc = .90 * @DesktopWidth HotKeySet("{ESC}", "Terminate") ; a way out of this While 1     Sleep(50)     _MGP() WEnd Func _MGP()     $pos = MouseGetPos()     If $pos[1] > $ycalc Or $pos[0] > $Xcalc Then Return ToolTip('X: ' & $pos[0] & ', Y: ' & $pos[1], 10, 10)     ToolTip('X: ' & $pos[0] & ', Y: ' & $pos[1]) EndFunc   ;==>_MGP Func Terminate()     Exit 0 EndFunc   ;==>Terminate


another approach... :D

8)

Posted Image

Clic The Pic!!!


#3 Ealric

Ealric

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 16 April 2008 - 07:37 PM

I actually started with a tooltip believe it or not. The only thing I didn't like about it was that it seemed more jerky than the label for some reason. Good alternative though, only your code doesn't support right/bottom screen bumping. :D

#4 Ealric

Ealric

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 17 April 2008 - 06:54 PM

Made changes to the script.

You can "ESC" out of the script to terminate it.
Coordinate positions properly identify to whether or not you are working on the desktop or if you are working within another active client window.

Basically, this allows you to retrieve exact coordinates for your mouse pointer based on the currently active window or desktop.

#5 Ealric

Ealric

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 28 April 2008 - 02:25 PM

EDIT: Changes

When you press ALT + F it will create a color.txt file and enter the date, time, (x,y coords) and hex color of the point your mouse is on. It will continue to append for every alt+f press you make.

If you want to terminate the app, press ESC.

Script updated.

#6 DexterMorgan

DexterMorgan

    My Member Title

  • Active Members
  • PipPipPipPipPipPip
  • 890 posts

Posted 28 April 2008 - 10:53 PM

EDIT: Changes

When you press ALT + F it will create a color.txt file and enter the date, time, (x,y coords) and hex color of the point your mouse is on. It will continue to append for every alt+f press you make.

If you want to terminate the app, press ESC.

Script updated.



May come in handy :D
code

#7 sbgwb0769

sbgwb0769

    Seeker

  • Banned (NOT IN USE)
  • 33 posts

Posted 17 May 2008 - 04:55 AM

very very good!!

thank you!

#8 dempo

dempo

    Seeker

  • New Members
  • 1 posts

Posted 18 June 2008 - 07:01 PM

Really usefully, thanks

#9 Ealric

Ealric

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 11 February 2009 - 07:12 PM

Updated : Fixed Array issues when clicking with mouse over tabbed areas. Updated color to provide save locations for Hex and Dec.

#10 corgano

corgano

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 724 posts

Posted 11 February 2009 - 11:24 PM

its nice, similar to a program i made, ecpt mine is a toolbar.

when it exports to the .txt file consider useing the basic X,Y method instead. easyer for copy & pasting into scripts. nicely done

2/11/2009 2:11:04 PM : X: 855,Y: 432 Hex: 0xE8F5FD Color: 15267325
to
2/11/2009 2:11:04 PM : X,Y: 855,432 Hex: 0xE8F5FD Color: 15267325

Edited by corgano, 11 February 2009 - 11:33 PM.

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users