Midnight notification

What is best way for AppleScript which is running and idling to notice that it is now midnight?

I don’t want to check every 60 seconds is it already midnight.

Cirno, Cirno, Cirno. :slight_smile: You ask more the three wise men can answer at times. :slight_smile:

The question is, do you need this to be exact or not?

If you don’t need it almost exact, then you check the time, and gives notice after it is midningt.

if you want it almost exact, then you try to figure out how many idle periods your app is running before midnight kicks in. You increase a counter for each time the idle handler run, when it is before the midnight, then you change the idle interval so it hits midnight. Then you change back to normal idle intervals afterwards.

I hope you get what I mean

launchd agent with criteria

<key>StartCalendarInterval</key> <dict> <key>Minute</key> <integer>0</integer> <key>Hour</key> <integer>0</integer> </dict>

A separate app, that only takes care of the notifications, and dies afterwards is of course the simplest solution, it shaves off a lot of unnecessariy complexity. :slight_smile: