Gibt bestimmt elegantere Lösungen aber guck mal ob dir das weiterhilft .
AutoIt
#include <Misc.au3>
$ptzdown = "down"
$ptzup = "up"
$ptzright = "right"
$ptzleft = "left"
$ptzdownright = "downright"
$ptzdownleft = "downleft"
$ptzupright = "upright"
$ptzupleft = "upleft"
While 1
If _IsPressed(57) OR _IsPressed(53) OR _IsPressed(41) OR _IsPressed(44) then
$ptz = ""
_tasten_abfragen()
ConsoleWrite($ptz & " gedrückt" & @CRLF)
while _tasten_abfragen()
ConsoleWrite("aktuell: " & $ptz & @CRLF)
sleep(50)
wend
ConsoleWrite($ptz & " losgelassen" & @CRLF)
EndIf
WEnd
Func _tasten_abfragen()
$iDown = False
$iUp = False
$iLeft = False
$iRight = False
If _IsPressed(57) Then $iDown = True
If _IsPressed(53) Then $iUp = True
If _IsPressed(41) Then $iLeft = True
If _IsPressed(44) Then $iRight = True
If $iDown Then $ptz = $ptzdown
If $iUp Then $ptz = $ptzup
If $iLeft Then $ptz = $ptzleft
If $iRight Then $ptz = $ptzright
If $iDown And $iLeft Then $ptz = $ptzdownleft
If $iDown And $iRight Then $ptz = $ptzdownright
If $iUp And $iLeft Then $ptz = $ptzupleft
If $iUp And $iRight Then $ptz = $ptzupright
If Not _IsPressed(57) And Not _IsPressed(53) And Not _IsPressed(41) And Not _IsPressed(44) Then
Return False
Else
Return True
EndIf
EndFunc
Alles anzeigen