#include #NoTrayIcon $x_tot = 0 $y_tot = 0 $tot = 0 Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $x = MouseGetPos(0) $y = MouseGetPos(1) TraySetClick(16) ; Only secondary mouse button will show the tray menu. $infoitem = TrayCreateItem("Info") TrayItemSetOnEvent(-1,"ShowInfo") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"ExitScript") TraySetState() While 1 $x_new = MouseGetPos(0) $y_new = MouseGetPos(1) If $x_new <> $x OR $y_new <> $y Then $x_tot = $x_tot + (Abs($x_new - $x)) $y_tot = $y_tot + (Abs($y_new - $y)) $tot = $tot + Int(Sqrt((Abs($x_new - $x))^2 + (Abs($y_new - $y))^2)) $x = MouseGetPos(0) $y = MouseGetPos(1) EndIf Sleep(10) ; Idle loop WEnd Exit ; Functions Func ShowInfo() Msgbox(0,"Km Parcourus par la souris","Distance en X (en nombre de pixel):"&$x_tot&@CRLF&"Distance en Y:"&$y_tot&@CRLF&"Distance Totale:"&$tot) EndFunc Func ExitScript() Exit EndFunc