Run_file command in a loop

One thing to try is:

live_loop :repeating_file_call do
  eval_file "C:/Music/song.rb"
end

Note that run_file will run the contents of the file as if you had pressed the Run button - this essentially creates a new thread to run the code so the thing that called run_file does not wait for it to finish (which is why you were having to explicitly call sleep to wait). However eval_file runs the contents of the file within the current thread as if it was a function call - so the existing thread will wait for it to finish before moving onto the next line.

3 Likes