ist nicht elegant sollte aber funktionieren...
[autoit]#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
Opt("TrayIconHide",1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Maus ControlPanel", 433, 159, 188, 122)
$Input2 = GUICtrlCreateInput("", 16, 32, 217, 21)
$Input1 = GUICtrlCreateInput("", 16, 88, 217, 21)
$Button1 = GUICtrlCreateButton("Start", 288, 24, 121, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Reset", 288, 56, 121, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Start fieser Modus", 288, 88, 121, 25, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("Anzahl", 16, 8, 36, 17)
$Label2 = GUICtrlCreateLabel("Geschwindigkeit (1 schnell, 100 langsam)", 16, 64, 199, 17)
$Label3 = GUICtrlCreateLabel("Zum Beenden des Mauszeigers ESC drücken", 16, 128, 258, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button4 = GUICtrlCreateButton("Exit", 288, 120, 121, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$speed = GUICtrlRead($Input1)
$zahl = GUICtrlRead($Input2)
$answer1 = MsgBox(4,"Mausspiel","Wirklich starten?")
If $answer1 = 7 Then
MsgBox(0,"Mausspiel","Das Programm wird nun beendet")
Exit
EndIf
For $i = 1 To $zahl
MouseMove(Random(1,@DesktopWidth),Random(1,@DesktopHeight), $speed)
If _IsPressed("1B") Then $i = $zahl
Next
MsgBox(0,"Mausspiel","Die Maus wurde " & $zahl & " mal über den Bildschirm bewegt")
Exit
Case $Button2
GUICtrlSetData($Input1,"")
GUICtrlSetData($Input2,"")
Case $Button3
GUISetState(@SW_HIDE)
$speed = GUICtrlRead($Input1)
$zahl = GUICtrlRead($Input2)
For $i = 1 To $zahl
MouseMove(Random(1,@DesktopWidth),Random(1,@DesktopHeight), $speed)
If _IsPressed("1B") Then $i = $zahl
Next
Exit
Case $Button4
Exit
EndSwitch
WEnd