erifash Posted March 28, 2005 Share Posted March 28, 2005 Thanks to burrup for the idea! expandcollapse popupHotkeySet("{ESC}", "myexit") HotkeySet("+{ESC}", "hide") Global $1, $2, $px, $py, $pixels Global $hidden = 0 If FileExists("pixels.txt") Then $pixels = Int(FileReadLine("pixels.txt", 1)) While 1 If mousemoved() Then chk() Wend Func chk() $px = 0 $py = 0 Select Case $1[0] > $2[0] $px = $1[0] - $2[0] Case $1[0] < $2[0] $px = $2[0] - $1[0] Case $1[1] > $2[1] $py = $1[1] - $2[1] Case $1[1] < $2[1] $py = $2[1] - $1[1] EndSelect $pixels = $pixels + $px + $py $cm = $pixels / 41.5 $me = $cm / 100 If $hidden = 0 Then ToolTip(Round($me, 2) & " m") Else ToolTip("") EndIf EndFunc Func mousemoved() $1 = MouseGetPos() Sleep(5) $2 = MouseGetPos() If $2[0] <> $1[0] or $2[1] <> $1[1] Then Return 1 Else Return 0 EndIf EndFunc Func hide() HotkeySet("+{ESC}", "unhide") $hidden = 1 EndFunc Func unhide() HotkeySet("+{ESC}", "hide") $hidden = 0 EndFunc Func myexit() Exit EndFunc Func OnAutoItExit() If FileExists("pixels.txt") Then FileDelete("pixels.txt") FileWrite("pixels.txt", $pixels) EndFunc It records the pixels into a file to see how many meters your mouse actually went! 1 cm = 41.5 pixels My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
zcoacoaz Posted March 28, 2005 Share Posted March 28, 2005 Good job! Something i recommend is creating a GUI or something that floats in the top left corner though so it doesn't flicker so much. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Smed Posted March 28, 2005 Share Posted March 28, 2005 Pretty cool, but your pixel distance calculation is wrong, it should be $pixels = $pixels + sqrt ($px*$px + $py*$py) and the Select staement becomes unnecessary since $var*$var will always be positive. I played around with showing velocity and acceleration but it wasn't nearly as interesting as I had hoped, and it changes so fast that no valuable information can be gleaned. (unless it was logged, which would be WAY to tedious to read.) 601DisengageEnd Program Link to comment Share on other sites More sharing options...
buzz44 Posted March 28, 2005 Share Posted March 28, 2005 (edited) np erifash, glad to see other people can get idea and learn from it =) and correction the Distance formula is D = sqrt((x2-x1)² + (y2-x1)²) in ur case $pixels = $pixels + sqrt((($2[0] - $1[0]) * ($2[0] - $1[0])) + (($2[1] - $1[1]) * ($2[1] - $1[1]))) edit: typo Correction* D = sqrt((x2-x1)² + (y2-y1)²) Edited March 29, 2005 by burrup qq Link to comment Share on other sites More sharing options...
erifash Posted March 28, 2005 Author Share Posted March 28, 2005 Thanks for the feedback. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver 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