smal script help

12/12/2013 10:22 piku#1
how can i add endless loop to my function ?
Code:
HotKeySet("{F10}", "first")
HotKeySet("{F8}", "ExitScript")

While 1
	Sleep(100)
WEnd

Func first()
Send("SPACE DOWN")
Sleep(160)
Send("SPACE UP")
EndFunc

Func ExitScript()
    Exit
EndFunc
im new in autoit so if someone can write it with the loop included thnx in advance
i practicly want a script that preses space with a same sleep time untill i press the exit button

Code:
Global $Should_i_Run = False;this line ($Should_i_Run is just example name that you can change to anything else if needed)
HotKeySet("{F10}", "Toggle");this line
HotKeySet("{F8}", "ExitScript")


While 1
    Sleep(1)
WEnd

Func Toggle();and this func
    $Should_i_Run = Not $Should_i_Run
    While $Should_i_Run
        Send("{SPACE DOWN}")
        Sleep(160)
        Send("{SPACE UP}")
		Sleep(160)
    WEnd
EndFunc   ;==>TurnOn

Func ExitScript()
    Exit (0)
 EndFunc   ;==>ExitScript
thnx for nothing i solved it myself