Hier gab es glaube ich schon einmal so ein Script, aber meins funktioniert auf jeden Fall und kann noch mehr
Es wird die mit dem Mauszeiger zurückgelegte Strecke in vielen Einheiten angezeigt.
Die Geschwindigkeits Anzeige ist zwar noch ein wenig verbuggt, aber der Rest stimmt exakt (Ich hab nachgemessen ).
(Damit das Script eure PPI berechnen kann, müsst ihr eure Bildschirmdiagonale in Zoll angeben.)
Edit: Habe jetzt statt Round, Floor verwendet. Ansonsten wird 0.5 Cm in 1Cm umgewandelt
Version 1.0:
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$iDeskDiag = IniRead("Data.ini", "Const", "DeskDiagInch", "Error")
If $iDeskDiag = "Error" Then
$iDeskDiag = InputBox("Bildschirmdiagonale", "Länge der Bildschirmdiagonale in Zoll: ", "17")
If StringReplace($iDeskDiag, " ", "") = "" Then Exit
IniWrite("Data.ini", "Const", "DeskDiagInch", $iDeskDiag)
EndIf
$PPI = Sqrt(@DesktopWidth ^ 2 + @DesktopHeight ^ 2) / $iDeskDiag
$PPCm = Sqrt(@DesktopWidth ^ 2 + @DesktopHeight ^ 2) / ($iDeskDiag * 2.54)
$hWnd = GUICreate("MouseMeter", 165, 275)
$Label1 = GUICtrlCreateLabel("Zurückgelegte Strecke:", 10, 10, 155)
GUICtrlSetFont($Label1, 10)
$Label2 = GUICtrlCreateLabel("Zentimeter:", 10, 40)
$Label3 = GUICtrlCreateLabel("0", 10, 55, 70)
$Label4 = GUICtrlCreateLabel("Meter:", 10, 75)
$Label5 = GUICtrlCreateLabel("0", 10, 90, 70)
$Label6 = GUICtrlCreateLabel("Inch:", 10, 110)
$Label7 = GUICtrlCreateLabel("0", 10, 125, 70)
$Label8 = GUICtrlCreateLabel("Pixel:", 10, 145)
$Label9 = GUICtrlCreateLabel("0", 10, 160, 70)
$Label10 = GUICtrlCreateLabel("Geschwindigkeit:", 10, 180, 155)
GUICtrlSetFont($Label10, 10)
$Label11 = GUICtrlCreateLabel("Meter/Sekunde:", 10, 205)
$Label12 = GUICtrlCreateLabel("0", 10, 220, 70)
$Label13 = GUICtrlCreateLabel("Meter/Sekunde (Durchschnitt):", 10, 235)
$Label14 = GUICtrlCreateLabel("0", 10, 250, 70)
$Reset = GUICtrlCreateButton("Zurücksetzen", 90, 75, 70, 25)
$Exit = GUICtrlCreateButton("Beenden", 90, 105, 70, 25)
GUISetState()
$aPosOld = MouseGetPos()
$iDistance = 0
$iTime = TimerInit()
AdlibRegister("_Update", 30)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Exit
Exit
Case $Reset
$iTime = TimerInit()
$iDistance = 0
_Update()
EndSwitch
WEnd
Func _Update()
$iTime2 = TimerInit()
$aPosNew = MouseGetPos()
$iDiff = _GetPointsDistance($aPosOld[0], $aPosOld[1], $aPosNew[0], $aPosNew[1])
$iDistance += $iDiff
GUICtrlSetData($Label3, Floor($iDistance / $PPCm))
GUICtrlSetData($Label5, Round($iDistance / $PPCm / 100, 2))
GUICtrlSetData($Label7, Round($iDistance / $PPI, 1))
GUICtrlSetData($Label9, Floor($iDistance))
GUICtrlSetData($Label12, Floor(($iDiff / $PPCm / 100) / (TimerDiff($iTime2) / 1000)))
GUICtrlSetData($Label14, Round(($iDistance / $PPCm / 100) / (TimerDiff($iTime) / 1000), 2))
$aPosOld[0] = $aPosNew[0]
$aPosOld[1] = $aPosNew[1]
EndFunc ;==>_Update
Func _GetPointsDistance($iPointX1, $iPointY1, $iPointX2, $iPointY2)
Return Sqrt(($iPointX1 - $iPointX2) ^ 2 + ($iPointY1 - $iPointY2) ^ 2)
EndFunc ;==>_GetPointsDistance
Version 1.1 (Besseres Design)
(Diese Version ist ein Topmost Fenster und hat außerdem keine Titelleiste, daher muss man einfach in das Fenster reinklicken um es zu verschieben)
Jetzt wird das Fenster mit leichter Verzögerung an die aktuelle Position gebracht.
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
$iGUIWidth = 165
$iGUIHeight = 290
$iX = @DesktopWidth - $iGUIWidth + $iGUIWidth / 2
$iY = @DesktopHeight - $iGUIHeight + $iGUIHeight / 2
$iDeskDiag = IniRead("Data.ini", "Const", "DeskDiagInch", "Error")
If $iDeskDiag = "Error" Then
$iDeskDiag = InputBox("Bildschirmdiagonale", "Länge der Bildschirmdiagonale in Zoll: ", "17")
If StringReplace($iDeskDiag, " ", "") = "" Then Exit
IniWrite("Data.ini", "Const", "DeskDiagInch", $iDeskDiag)
EndIf
$PPI = Sqrt(@DesktopWidth ^ 2 + @DesktopHeight ^ 2) / $iDeskDiag
$PPCm = Sqrt(@DesktopWidth ^ 2 + @DesktopHeight ^ 2) / ($iDeskDiag * 2.54)
$hWnd = GUICreate("MouseMeter", $iGUIWidth, $iGUIHeight, $iX - $iGUIWidth / 2, $iY - $iGUIHeight / 2, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0x545454, $hWnd)
$Label1 = GUICtrlCreateLabel("Zurückgelegte Strecke:", 10, 10, 155)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label2 = GUICtrlCreateLabel("Zentimeter:", 10, 40)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label3 = GUICtrlCreateLabel("0", 10, 55, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("Meter:", 10, 75)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label5 = GUICtrlCreateLabel("0", 10, 90, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label6 = GUICtrlCreateLabel("Inch:", 10, 110)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label7 = GUICtrlCreateLabel("0", 10, 125, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label8 = GUICtrlCreateLabel("Pixel:", 10, 145)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label9 = GUICtrlCreateLabel("0", 10, 160, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label10 = GUICtrlCreateLabel("Geschwindigkeit:", 10, 180, 155)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10)
$Label11 = GUICtrlCreateLabel("Meter/Sekunde:", 10, 205)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label12 = GUICtrlCreateLabel("0", 10, 220, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label13 = GUICtrlCreateLabel("Meter/Sekunde (Durchschnitt):", 10, 235, 100, 50)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label14 = GUICtrlCreateLabel("0", 10, 265, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Reset = GUICtrlCreateButton("Zurücksetzen", 90, 75, 70, 25)
$Exit = GUICtrlCreateButton("Beenden", 90, 105, 70, 25)
GUISetState()
WinSetTrans($hWnd, "", 200)
[/autoit] [autoit][/autoit] [autoit]$aPosOld = MouseGetPos()
$iDistance = 0
$iTime = TimerInit()
AdlibRegister("_Update", 30)
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE, $Exit
Exit
Case $Reset
$iTime = TimerInit()
$iDistance = 0
_Update()
Case $GUI_EVENT_PRIMARYDOWN
_SetPos()
EndSwitch
WEnd
Func _Update()
$iTime2 = TimerInit()
$aPosNew = MouseGetPos()
$iDiff = _GetPointsDistance($aPosOld[0], $aPosOld[1], $aPosNew[0], $aPosNew[1])
$iDistance += $iDiff
GUICtrlSetData($Label3, Floor($iDistance / $PPCm))
GUICtrlSetData($Label5, Round($iDistance / $PPCm / 100, 2))
GUICtrlSetData($Label7, Round($iDistance / $PPI, 1))
GUICtrlSetData($Label9, Floor($iDistance))
GUICtrlSetData($Label12, Floor(($iDiff / $PPCm / 100) / (TimerDiff($iTime2) / 1000)))
GUICtrlSetData($Label14, Round(($iDistance / $PPCm / 100) / (TimerDiff($iTime) / 1000), 2))
$aPosOld[0] = $aPosNew[0]
$aPosOld[1] = $aPosNew[1]
EndFunc ;==>_Update
Func _SetPos()
Sleep(200)
While _IsPressed("01")
$aPosMouse = MouseGetPos()
$iDiffX = $iX - $aPosMouse[0]
If $iDiffX < 0 Then $iDiffX *= -1
$iDiffY = $iY - $aPosMouse[1]
If $iDiffY < 0 Then $iDiffY *= -1
$iSpeedX = $iDiffX / 10
$iSpeedY = $iDiffY / 10
If $iX < $aPosMouse[0] Then
$iX += $iSpeedX
ElseIf $iX > $aPosMouse[0] Then
$iX -= $iSpeedX
EndIf
If $iY < $aPosMouse[1] Then
$iY += $iSpeedY
ElseIf $iY > $aPosMouse[1] Then
$iY -= $iSpeedY
EndIf
WinMove($hWnd, "", $iX - $iGUIWidth / 2, $iY - $iGUIHeight / 2)
Sleep(30)
WEnd
EndFunc ;==>_SetPos
Func _GetPointsDistance($iPointX1, $iPointY1, $iPointX2, $iPointY2)
Return Sqrt(($iPointX1 - $iPointX2) ^ 2 + ($iPointY1 - $iPointY2) ^ 2)
EndFunc ;==>_GetPointsDistance
Version 1.2 (statt Round wurde Floor verwendet)
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
$iGUIWidth = 165
$iGUIHeight = 290
$iX = @DesktopWidth - $iGUIWidth + $iGUIWidth / 2
$iY = @DesktopHeight - $iGUIHeight + $iGUIHeight / 2
$iDeskDiag = IniRead("Data.ini", "Const", "DeskDiagInch", "Error")
If $iDeskDiag = "Error" Then
$iDeskDiag = InputBox("Bildschirmdiagonale", "Länge der Bildschirmdiagonale in Zoll: ", "17")
If StringReplace($iDeskDiag, " ", "") = "" Then Exit
IniWrite("Data.ini", "Const", "DeskDiagInch", $iDeskDiag)
EndIf
$PPI = Sqrt(@DesktopWidth ^ 2 + @DesktopHeight ^ 2) / $iDeskDiag
$PPCm = Sqrt(@DesktopWidth ^ 2 + @DesktopHeight ^ 2) / ($iDeskDiag * 2.54)
$hWnd = GUICreate("MouseMeter", $iGUIWidth, $iGUIHeight, $iX - $iGUIWidth / 2, $iY - $iGUIHeight / 2, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0x545454, $hWnd)
$Label1 = GUICtrlCreateLabel("Zurückgelegte Strecke:", 10, 10, 155)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label2 = GUICtrlCreateLabel("Zentimeter:", 10, 40)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label3 = GUICtrlCreateLabel("0", 10, 55, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("Meter:", 10, 75)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label5 = GUICtrlCreateLabel("0", 10, 90, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label6 = GUICtrlCreateLabel("Inch:", 10, 110)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label7 = GUICtrlCreateLabel("0", 10, 125, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label8 = GUICtrlCreateLabel("Pixel:", 10, 145)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label9 = GUICtrlCreateLabel("0", 10, 160, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label10 = GUICtrlCreateLabel("Geschwindigkeit:", 10, 180, 155)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10)
$Label11 = GUICtrlCreateLabel("Meter/Sekunde:", 10, 205)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label12 = GUICtrlCreateLabel("0", 10, 220, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label13 = GUICtrlCreateLabel("Meter/Sekunde (Durchschnitt):", 10, 235, 100, 50)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label14 = GUICtrlCreateLabel("0", 10, 265, 70)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0xFFFFFF)
$Reset = GUICtrlCreateButton("Zurücksetzen", 90, 75, 70, 25)
$Exit = GUICtrlCreateButton("Beenden", 90, 105, 70, 25)
GUISetState()
WinSetTrans($hWnd, "", 200)
[/autoit] [autoit][/autoit] [autoit]$aPosOld = MouseGetPos()
$iDistance = 0
$iTime = TimerInit()
AdlibRegister("_Update", 30)
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE, $Exit
Exit
Case $Reset
$iTime = TimerInit()
$iDistance = 0
_Update()
Case $GUI_EVENT_PRIMARYDOWN
_SetPos()
EndSwitch
WEnd
Func _Update()
$iTime2 = TimerInit()
$aPosNew = MouseGetPos()
$iDiff = _GetPointsDistance($aPosOld[0], $aPosOld[1], $aPosNew[0], $aPosNew[1])
$iDistance += $iDiff
GUICtrlSetData($Label3, Floor($iDistance / $PPCm))
GUICtrlSetData($Label5, Floor($iDistance / $PPCm / 100))
GUICtrlSetData($Label7, Floor($iDistance / $PPI))
GUICtrlSetData($Label9, Floor($iDistance))
GUICtrlSetData($Label12, Round(($iDiff / $PPCm / 100) / (TimerDiff($iTime2) / 1000), 4))
GUICtrlSetData($Label14, Round(($iDistance / $PPCm / 100) / (TimerDiff($iTime) / 1000), 4))
$aPosOld[0] = $aPosNew[0]
$aPosOld[1] = $aPosNew[1]
EndFunc ;==>_Update
Func _SetPos()
Sleep(200)
While _IsPressed("01")
$aPosMouse = MouseGetPos()
$iDiffX = $iX - $aPosMouse[0]
If $iDiffX < 0 Then $iDiffX *= -1
$iDiffY = $iY - $aPosMouse[1]
If $iDiffY < 0 Then $iDiffY *= -1
$iSpeedX = $iDiffX / 10
$iSpeedY = $iDiffY / 10
If $iX < $aPosMouse[0] Then
$iX += $iSpeedX
ElseIf $iX > $aPosMouse[0] Then
$iX -= $iSpeedX
EndIf
If $iY < $aPosMouse[1] Then
$iY += $iSpeedY
ElseIf $iY > $aPosMouse[1] Then
$iY -= $iSpeedY
EndIf
WinMove($hWnd, "", $iX - $iGUIWidth / 2, $iY - $iGUIHeight / 2)
Sleep(30)
WEnd
EndFunc ;==>_SetPos
Func _GetPointsDistance($iPointX1, $iPointY1, $iPointX2, $iPointY2)
Return Sqrt(($iPointX1 - $iPointX2) ^ 2 + ($iPointY1 - $iPointY2) ^ 2)
EndFunc ;==>_GetPointsDistance