Creating a daily alert with days left on the notification

0

I want to create a daily notification which shows days remaining until an event ("1583 days remaining...").

Is that possible to do on a Macbook?

citni

Posted 2016-11-04T08:31:36.283

Reputation: 101

Answers

0

I've struggled with date manipulation in general and with AppleScript specifically. That said, here's an approach I've used based on the info from Apple.

set minutes to 60
set hours to (minutes * 60)
set days to (hours * 24)

set myDate to current date -- Nov 4, 2016
log myDate
copy myDate to otherDate
set the day of otherDate to 1
set the month of otherDate to January
set the year of otherDate to 2017
set time of otherDate to "0" -- set time to midnight
set daysUntil to ((otherDate - myDate) / days) as integer
display dialog daysUntil & " until New Year's Day, 2017" as string

I'm sure there's an easier way to do this but this is as much as I've needed to use this function for.

SaxDaddy

Posted 2016-11-04T08:31:36.283

Reputation: 3 181

Hey, thanks for the response! But this is not really what I was looking for.

I am trying to make a notification like when you get new mail (a box appears in top right corner). And do it automatically and daily. – citni – 2016-11-09T19:01:17.063

@citni Okay but that's what you asked for. Have you pulled your mall client's library in to Script Editor? ICYDK, open the Library window in Script Editor and drag an app in from Finder. If it has a scriptable library, it will be available here for help. I find this invaluable for learning an app's methods/properties. GL – SaxDaddy – 2016-11-09T21:12:21.043