Das programm maus-o-meter errechnet wieviele cm deine muse zurück legt
Spoiler anzeigen
#Include <Constants.au3>
[/autoit] [autoit][/autoit] [autoit]Opt("TrayMenuMode",1+2) ; Default tray menu items (Script Paused/Exit) will not be shown.
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Mausometer", "REG_SZ", @ScriptFullPath)
;---- bearbeiten der Ini ----
$Sitzung = 1
$Gesammt = IniRead(@ScriptDir & "\mouse.ini","Gesammt","cm",0) ;gesammtauslesen
$Zoll = IniRead(@ScriptDir & "\mouse.ini","Zoll","Zoll",0) ;Zoll auslesen
;---- Zoll ----
If $Zoll = 0 then
$zoll = InputBox("Maus-o-meter","Gib deine Bildschirm größe in Zoll an"); wenn kein wert vor handen manuell eingeben
IniWrite(@ScriptDir & "\mouse.ini","Zoll","Zoll",$zoll) ;Zoll Speichern
Endif
;>-- Ende zoll
;---- dpi ----
$dpi = @DesktopHeight^2 + @DesktopWidth^2 ; Dpi ausrechnen
$x = ($dpi/3)
$y = ($dpi/$x)
$0 = 0
Do
$x1 = (($x+$y)/2)
$y1 = ($dpi/$x1)
$x = (($x1+$y1)/2)
$y = ($dpi/$x)
$0 = $0 + 1
until $0 = 10
$dpi = $x / $zoll
;<== Ende DPI-Berechnung
$chkitem = TrayCreateItem("Gesammt cm = ")
$Alle= TrayCreateItem($gesammt)
$checkeditem = TrayCreateItem("cm während dieser Sitzung = ")
$Heute = TrayCreateItem($Sitzung)
$exititem = TrayCreateItem("Exit")
While True
$msg = TrayGetMsg()
TrayItemSetOnEvent($exititem,"_Exit")
$pos1 = mouseGetPos();<-- coordinaten sammeln
Sleep(100)
$pos2 = mouseGetPos()
;~ MsgBox(0,$pos1[0] & " " & $pos1[1],$pos2[0] & " " & $pos2[1]);coords anzeigen
$1 = $pos1[0] - $pos2[0]
$2 = $pos1[1] - $pos2[1]
if $1 == 0 then
if $2 == 0 then
;~ msgbox(0,"Maus-o-meter", "Du hast die Maus nicht bewegt.")
ContinueLoop
EndIf
EndIf
if $pos2[0]>=$pos1[0] and $pos1[1]>=$pos2[1] Then; + steigung
$1 = $pos1[0] - $pos2[0];826- 169
$2 = $pos2[1] - $pos1[1];1183- 471
;~ MsgBox(0,"Seiten in pixeln",$1& @crlf & $2)
$1 = $1^2
$2 = $2^2
;~ MsgBox(0,"Seiten im quadrat",$1& @crlf & $2)
$a = $2+ $1
$0 = 0
$x = ($a/3)
$y = ($a/$x)
Do
$x1 = (($x+$y)/2)
$y1 = ($a/$x1)
$x = (($x1+$y1)/2)
$y = ($a/$x)
$0 = $0 + 1
until $0 = 10
;~ MsgBox(0,"pixel",$x)
$cm = $x*2.54/$dpi
;~ MsgBox(0,"",$cm)
$Gesammt = $Gesammt+$cm
IniDelete(@ScriptDir & "\mouse.ini","Gesammt","cm")
IniWrite(@ScriptDir & "\mouse.ini","Gesammt","cm",$Gesammt)
$Sitzung = $Sitzung +$cm
;---- ende + Steigung
Elseif $pos1[0]>=$pos2[0] and $pos2[1]>=$pos1[1] then; - Steigung
$1 = $pos2[0] - $pos1[0];826- 169
$2 = $pos1[1] - $pos2[1];1183- 471
;~ MsgBox(0,"Seiten in pixeln",$1& @crlf & $2)
$1 = $1^2
$2 = $2^2
;~ MsgBox(0,"Seiten im quadrat",$1& @crlf & $2)
$a = $2+ $1
$0 = 0
$x = ($a/3)
$y = ($a/$x)
Do
$x1 = (($x+$y)/2)
$y1 = ($a/$x1)
$x = (($x1+$y1)/2)
$y = ($a/$x)
$0 = $0 + 1
until $0 = 10
;~ MsgBox(0,"pixel",$x)
$cm = $x*2.54/$dpi
;~ MsgBox(0,"",$cm)
$Gesammt = $Gesammt+$cm
$Sitzung = $Sitzung +$cm
IniDelete(@ScriptDir & "\mouse.ini","Gesammt","cm")
IniWrite(@ScriptDir & "\mouse.ini","Gesammt","cm",$Gesammt)
Elseif $pos2[0]>=$pos1[0] and $pos2[1]>=$pos1[1] then; - Steigung
$1 = $pos2[0] - $pos1[0];826- 169
$2 = $pos2[1] - $pos1[1];1183- 471
;~ MsgBox(0,"Seiten in pixeln",$1& @crlf & $2)
$1 = $1^2
$2 = $2^2
;~ MsgBox(0,"Seiten im quadrat",$1& @crlf & $2)
$a = $2+ $1
$0 = 0
$x = ($a/3)
$y = ($a/$x)
Do
$x1 = (($x+$y)/2)
$y1 = ($a/$x1)
$x = (($x1+$y1)/2)
$y = ($a/$x)
$0 = $0 + 1
until $0 = 10
;~ MsgBox(0,"pixel",$x)
$cm = $x*2.54/$dpi
;~ MsgBox(0,"",$cm)
$Gesammt = $Gesammt+$cm
$Sitzung = $Sitzung +$cm
IniDelete(@ScriptDir & "\mouse.ini","Gesammt","cm")
IniWrite(@ScriptDir & "\mouse.ini","Gesammt","cm",$Gesammt)
Elseif $pos1[0]>=$pos2[0] and $pos1[1]>=$pos2[1] then; - Steigung
$1 = $pos1[0] - $pos2[0];826- 169
$2 = $pos1[1] - $pos2[1];1183- 471
;~ MsgBox(0,"Seiten in pixeln",$1& @crlf & $2)
$1 = $1^2
$2 = $2^2
;~ MsgBox(0,"Seiten im quadrat",$1& @crlf & $2)
$a = $2+ $1
$0 = 0
$x = ($a/3)
$y = ($a/$x)
Do
$x1 = (($x+$y)/2)
$y1 = ($a/$x1)
$x = (($x1+$y1)/2)
$y = ($a/$x)
$0 = $0 + 1
until $0 = 10
;~ MsgBox(0,"pixel",$x)
$cm = $x*2.54/$dpi
;~ MsgBox(0,"",$cm)
$Gesammt = $Gesammt+$cm
$Sitzung = $Sitzung +$cm
IniDelete(@ScriptDir & "\mouse.ini","Gesammt","cm")
IniWrite(@ScriptDir & "\mouse.ini","Gesammt","cm",$Gesammt)
EndIf
TrayItemSetText($Alle,$gesammt)
TrayItemSetText($Heute,$Sitzung)
If $msg = $exititem Then
_Exit()
Endif
WEnd
Func _Exit()
Exit
EndFunc
;MsgBox(0,"Maus-o-meter","Deine Gesammt Strecke beträgt = " &$Gesammt & " cm"& @crlf & "Während dieser Sitzung hat deine Maus " & $Sitzung &" zurückgelegt.")
die Ini dazu
es können noch fehler enthalten sein
mfg Buphy