user5139637
user5139637

Reputation: 785

How to run applescript at scheduled time

How can I run my apple script at a scheduled time. I want it to run every 45 minutes, but I do not know how to do this. I saved my apple script as an application. What should I do next?

Thanks

(Currently, I am using the on idle function, but is there a better way to do so?)

Upvotes: 7

Views: 10562

Answers (3)

Lukasz Czerwinski
Lukasz Czerwinski

Reputation: 15432

I would set up crontab to run the script using osascript command. See https://betterprogramming.pub/https-medium-com-ratik96-scheduling-jobs-with-crontab-on-macos-add5a8b26c30 for example.

Because crontab sets time in hours and minutes, I would set the Apple Script to run every 15 minutes and check in the first lines if it's the right time to start the body of the script.

Upvotes: 2

Craig Smith
Craig Smith

Reputation: 1071

Check out this launchd tutorial for running an AppleScript on a schedule.

Upvotes: 0

vadian
vadian

Reputation: 285079

There are two ways:

  • Create a recurring event in Calendar.app which triggers the script
  • Create a launchd agent in ~/Library/LaunchAgents with the key StartInterval value 2700

Both ways can handle standard compiled scripts (.scpt or .scptd)

Upvotes: 7

Related Questions