Thursday, July 9, 2020

#1 2020-06-30 12:09:57 am

angehc
Member
Registered: 2020-06-29
Posts: 2

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

Offline

 

#2 2020-06-30 03:20:53 am

ldicroce
Member
Registered: 2017-11-25
Posts: 200

Re: Running speedtest app once an hour

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:

Applescript:

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

Last edited by ldicroce (2020-06-30 03:23:13 am)

Offline

 

#3 2020-06-30 06:41:29 pm

angehc
Member
Registered: 2020-06-29
Posts: 2

Re: Running speedtest app once an hour

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?

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)