Running speedtest app once an hour

Hi, total and complete newbie here.

I’m trying to automate running Speedtest (via Speedtest app) once an hour to gather data. I’ve got the following script, and exported to an app, with “Stay open after run handler” ticked.

If I have the runInterval set to (1 * minutes) it seems to loop ok, but anything other than 1 minute it doesn’t repeat after the initial launch of the application.

on idle
set runInterval to (15 * minutes)
tell application “Speedtest”
run
end tell
tell application “System Events”
tell process “Speedtest”
click menu item “Begin Test” of menu 1 of menu bar item “File” of menu bar 1
end tell
end tell
set c to time of (get current date)
set nextRun to runInterval - (c mod runInterval)
end idle

Any help would be super appreciated.

Model: MacBook Air
AppleScript: 2.7
Browser: Safari 537.36
Operating System: macOS 10.14

Here you can find all the info you need:
https://macscripter.net/viewtopic.php?id=35142

basically you have to set the cycling time by using:

return 5 # it's this value which defines the time to wait before next pass  expressed in seconds

in your case it would be 3600

Thanks. That’s worked!

It seems though that if I launch the application and don’t do anything else on my computer, the app will run like its supposed to. But if I click out of the window (say to chrome and use chrome), then it stops running.

Is there a way to make the app run in the background?