in Code

Applescript and regular actions

I was wondering how I could have Simplenote Yojimbo Sync (henceforth, SNYS) running regularly, and thinking of all sorts of methods involving launchd, but actually it seems very simple to do with Applescript, which is where I should have looked in the first place.

From p76 of the Applescript Language Guide:

Stay-open script applications can perform periodic actions, even in the background, as long as the script application is running.

What I need therefore is an idle handler.

If a stay-open script application includes an idle handler, AppleScript sends the script application periodic idle commands—by default, every 30 seconds—allowing it to perform background tasks when it is not performing other actions.

So, I will put one of those in and it will run the sync periodically and everything will be happy. That should be straightforward.