#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <Date.au3>
$fh = FileOpen("Test.txt",$FO_APPEND)
If $fh = -1 Then
MsgBox($MB_OK,"ERROR","")
Exit 1
EndIf
$Sum = 0
For $i = 1 To 100 Step 1
FileWriteLine($fh,"Sum =" & $i)
FileWriteLine($fh,"The time is:" & _NowTime())
Send("{^s}")
Sleep(300000)
Next
FileWriteLine($fh,"end loop sucess")
FileClose($fh)