Jump to content

pantho

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Location
    Budapest

pantho's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks for the tip ;-) ToolTip is always visible in the corner, so there is no flickering Here is the simplified version, any suggestion? #include <Date.au3> Local $delay, $ret, $status While 1 $ret = RunWait("s:\php\php.exe -f script.php", "s:\php\") $status = "Last run: " & StringRight(_NowCalc(), 8) & " Return: " & $ret If ($ret=0) Then ; if no error in scripting, adding next run info to status $delay = Random(3*1000, 6*1000, 1) $status = $status & " Next run: " & StringRight(_DateAdd('s', Round($delay/1000), _NowCalc()), 8) EndIf ToolTip($status, 0, 0) If ($ret<>0) Then ; if error in scripting, end program MsgBox(0, "Warning", "Return code: " & $ret) Exit EndIf Sleep($delay) WEnd
  2. Thanks for help, what do you think about this basic solution (any advice?): HotKeySet("{ESC}", "ExitProgram") Local $delay Local $ret Local $status Local $next, $nday, $nhour, $nmin, $nsec While 1 $ret = RunWait("s:\php\php.exe -f script.php", "s:\php\") $status = "Last run: " & @HOUR & ":" & @MIN & ":" & @SEC & " Return: " & $ret If ($ret=0) Then ; if no error in scripting, adding next run info to status $delay = Random(3*1000, 6*1000, 1) ; delay to next run $next = @HOUR*60*60 + @MIN*60 + @SEC + Round($delay/1000) ; calculating next run in HH:MM:SS format $nday = Floor($next/86400) $nhour = Floor($next/3600) - ($nday*24) $nmin = Floor($next/60) - ($nday*1440) - ($nhour*60) $nsec = Mod($next, 60) ;$nhour = Floor($next/3600); ;$nmin = Floor(Mod(($next/60),60)); ;$nsec = Mod($next,60); $status = $status & " Next run: " & StringFormat("%02d",$nhour) & ":" & StringFormat("%02d",$nmin) & ":" & StringFormat("%02d",$nsec) EndIf ToolTip($status, 0, 0) ; displaying status info If ($ret<>0) Then ; if error in scripting, end program MsgBox(0, "Warning", "Return code: " & $ret) Exit EndIf Sleep($delay) ; waiting for next run WEnd Func ExitProgram() ; to terminating the program manually Exit EndFunc
  3. Hi I looking for AutoIt code to continuously execute PHP script with random X sec delay between starts (where X is in interval FROM-TO) Steps: Step 1. wait random X seconds (X in FROM-TO interval) Step 2. execute PHP interpreter+script: "c:\php\php.exe script.php" Step 3. if scripts exit code==0 back to step 1, else warning and stop + button to terminate the AutoIt script Thanks for help.
×
×
  • Create New...