How can I send an email or text message when a break is due or done?

I recently had an interesting customer request. They wanted to send an email or text message when a break was due, in case they were away from their Mac.

So I added a couple of new scripts to the Time Out Extras page.

The first one is called Send Email, which as you might imagine, sends an email message. Download it here.

Here’s the script; after downloading it, you’ll need to edit it to replace the two instances of example@example.com with your email address; you can customize the subject and content of the message as desired:

tell application "Mail"
	set my_message to make new outgoing message
	set subject of my_message to "Time Out break"
	set content of my_message to "Time for a break...."
	set sender of my_message to "example@example.com"
	--
	tell my_message
		make new to recipient at end of to recipients with properties {name:"example@example.com"}
	end tell
	--
	send my_message
end tell

The second script is called Send Message, which you may be amazed to learn sends a text message (via iMessage, Apple’s “blue bubble” messaging protocol). Download it here.

Here’s the script; after downloading it, you’ll need to edit it to replace the example@example.com with your iCloud email address or phone number; you can customize the message as desired:

tell application "Messages"
	set targetBuddy to "example@example.com"
	set targetService to id of 1st account whose service type = iMessage
	set textMessage to "Time for a break!"
	set theBuddy to participant targetBuddy of account id targetService
	send textMessage to theBuddy
end tell

To install the scripts, open the Time Out settings window, select a break, and go to the Break Actions page, then click the + button and choose the Reveal Scripts menu command:

Break Actions menu

Then drag the script files into that revealed folder. Then they will appear in that menu so you can choose one of them.

As always, you can choose to use these scripts before the break is due, when it starts, or when it is done, amongst other options. If you have a long break that you spend away from your Mac, a message when it is done could be very useful:

Send Email after done

If you want to send a message when a break is due, note that if you’re away from your Mac, by default the breaks are skipped, so it won’t send the messages. You can avoid that by choosing to Continue Countdown on the Break Schedule page:

Contine Countdown schedule option

As previously mentioned, I plan to write an iOS edition of Time Out, probably later this year. Once that’s done, you’ll be able to get notified of breaks on your iPhone, even when away from your Mac. But these scripts may be useful in the meantime. Enjoy!