I'm trying to create a timer switch button using _KeyPressed $Timer = 100 While 1 If _IsPressed(31) Then Sleep(100) If _IsPressed(31) Then MsgBox("","Time",$Timer) ExitLoop ; EndIf Sleep(100) $Timer = $Timer + $Timer EndIf WEnd I need it so When pressed it starts the timer, when pressed again it stops the timer... EDIT: I've semi got something working: #include <misc.au3> $Timer = 100 While 1 If _IsPressed("31") Then While _IsPressed("31") Sleep(100)