countdown timer for Mail signature?

Is it possible to create a Mail signature that contains a countdown timer?

I only want to display number of days until theEnd. The applescript for the calculation is simple enough, but that doesn’t get the result into a signature…

THanks for any advice,
Dee Dee

Hi deesquared,

The dictionary for Contacts:

So, to make a signature, you would do something like this:

tell app "Contacts"
make new signature with properties {name:"Sig1",content:(current date) as string}
end tell

Then you can keep changing the content property every day until theEnd with something like:

tell app "Contacts"
set content of signature "Sig1" to someDate
end tell

I haven’t tested anything, but actually your post needs more info.

Edited: oops, replace Contacts with Mail.:slight_smile:


I don’t know about anyone else, but my Mail isn’t working right with AppleScript. After I run a script the dialog windows don’t close.

Hi Kel,
Thanks for your help!

I discovered this problem too, right about the same time you posted this. ugh.

Anyway, what I want to do is just have a very simple signature line that gives how many days until theEnd.
(I’m a very bad newbie, but here is what I have tested with:)

	set endDate to date "Sunday, August 31, 2014 12:00:00 AM"
	set theEnd to (endDate - (current date)) div days as string
	set endString to " days remaining"
	set theText to theEnd & endString
tell application "Mail"
	make new signature with properties {name:"TimeLeft", content:theText}
end tell

But this doesn’t actually create a new signature that I can see. (Plus it messes up my Mail so I have to quit, then restart Mail to open the preferences…)

Hi deesquared,

A workaround might be to manually create your signatures. Then have your script set the current signature. I see in the dictionary where you can set it to sequentially. If that doesn’t work you could have your script go through a list of signature names. I’d do some testing. For instance, after manually creating your signatures. Run an AppleScirpt like:

tell app "Mail"
name of every signature
end tell

This should give you a list of signature names that you can iterate through daily.