Jump to content

Mouse Distance Clocker


Marlo
 Share

Recommended Posts

So the WoW servers went down stupidly early today so i had nothing better to do than make a script that measured how far my mouse had traveled on screen :D

I also went through the trouble of finding out how many pixels there were to an inch on my screen (was 80) but that will probably be different for you. First script ive made in a while so i hope you like it.

So here it be:

#include <String.au3>

Global Const $iPixToInch = 80 ;80 pixels to an inch on my screen
Global Const $iInchToKilometer = 39370.0787 ;39370.0787 Inches to a Kilometer

Global $iOldPos, $iNewPos, $iInches, $iKilometers, $iDistance
Global $sSaveFile = @ScriptDir & "\Mouse Measure.ini"

$iDistance = int(IniRead($sSaveFile, "Statistics", "Overall", 0))

Opt("OnExitFunc", "_Save")
AdlibEnable("_Save", 1000)

$iNewPos = MouseGetPos()
$iOldPos = MouseGetPos()

While True
    $iNewPos = MouseGetPos()
    $iDistance += Abs($iNewPos[0] - $iOldPos[0])
    $iDistance += Abs($iNewPos[1] - $iOldPos[1])
    $iOldPos = $iNewPos
    Sleep(2)
WEnd

Func _Save()
    $iInches = Round($iDistance/$iPixToInch, 1)
    $iKilometers = Round($iInches/$iInchToKilometer, 2)
    TraySetToolTip("Pixels Traveled: " & _StringAddThousandsSep($iDistance) & @CR & _
                   "Inches Traveled: " & _StringAddThousandsSep($iInches) & @CR & _
                   "Kilometers Traveled: " & _StringAddThousandsSep($iKilometers))
    Iniwrite($sSaveFile, "Statistics", "Overall", $iDistance)
EndFunc
Click here for the best AutoIt help possible.Currently Working on: Autoit RAT
Link to comment
Share on other sites

<br />this is pretty cool. there has to be a way to find PixToInch by the resolution and monitor size... <br /><br />awesome script<br />

<br /><br /><br />

try this

$Diag_in_pixel = Sqrt(@DesktopWidth*@DesktopWidth + @DesktopHeight*@DesktopHeight)  ; remember Pythagoras ?
$Diag_in_inch = InputBox( "Calculate your monitor DPI", "Type monitor size in inches. Please keep in mind" & @CRLF & _
                                                        "you need to measure the DIAGONAL size, this is how" & @CRLF & _
                                                        "monitor size is usually specified !", "", " M", 300, 150)
$DPI = Round( $Diag_in_pixel / Number($Diag_in_inch) )
If $DPI > 0 And $DPI < 500 Then MsgBox(0, "Your monitor", "has " & $DPI & " dpi")
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...