set start_value to do shell script "ruby -e 'print Time.now.to_f'"
repeat while true
-- Your code goes here
set end_value to do shell script "ruby -e 'print Time.now.to_f'"
if end_value - start_value ≥ 1 then
exit repeat
end if
end repeat
You just want it to run a loop as fast as possible for a specific duration?
Code:set start_value to do shell script "ruby -e 'print Time.now.to_f'" repeat while true -- Your code goes here set end_value to do shell script "ruby -e 'print Time.now.to_f'" if end_value - start_value ≥ 1 then exit repeat end if end repeat
The above code will run through a loop for one second. Change the value in the if statement to adjust the amount of time. Note that you can also specify partial seconds, such as 2.5.
Can't help you with your other problem.
You just want it to run a loop as fast as possible for a specific duration?
Code:set start_value to do shell script "ruby -e 'print Time.now.to_f'" repeat while true -- Your code goes here set end_value to do shell script "ruby -e 'print Time.now.to_f'" if end_value - start_value ≥ 1 then exit repeat end if end repeat
The above code will run through a loop for one second. Change the value in the if statement to adjust the amount of time. Note that you can also specify partial seconds, such as 2.5.
Can't help you with your other problem.
You just want it to run a loop as fast as possible for a specific duration?
Code:set start_value to do shell script "ruby -e 'print Time.now.to_f'" repeat while true -- Your code goes here set end_value to do shell script "ruby -e 'print Time.now.to_f'" if end_value - start_value ≥ 1 then exit repeat end if end repeat
The above code will run through a loop for one second. Change the value in the if statement to adjust the amount of time. Note that you can also specify partial seconds, such as 2.5.
Can't help you with your other problem.
ytk When I run your code without adding anything it runs as expected, runs for 1 second then stops. But when I add my code it stops after running my code once (below). It returns 7 then it ends, instead of continously running for 10 seconds. Is there a way to run the code continously for the time listed in the code?
set start_value to do shell script "ruby -e 'print Time.now.to_f'"
repeat while true
set end_value to do shell script "ruby -e 'print Time.now.to_f'"
return "7"
if end_value - start_value ≥ 10 then
exit repeat
end if
end repeat