Sign in to follow this  
Followers 0
Marlo

Mouse Distance Clocker

5 posts in this topic

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

Share this post


Link to post
Share on other sites



this is pretty cool. there has to be a way to find PixToInch by the resolution and monitor size...

awesome script

There probably is but i didnt look too far into it to be honest. Just drew a 200x200 pix box on my screen and measured it with a ruler :D


Click here for the best AutoIt help possible.Currently Working on: Autoit RAT

Share this post


Link to post
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")

Share this post


Link to post
Share on other sites

@marlo

See here : http://www.autoitscript.com/forum/index.php?showtopic=86154

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0