---
layout: post
title: My Scripts for Pomodoro Desktop
author: Steven
date: 2010-03-26 03:09:57
categories: 
- Musings
tags: 
- os x
- software
featured_image: https://www.stevenjaycohen.com/wp-content/uploads/2016/07/wsi-imageoptim-happy-mac-icon.png
---
Pomodoro Desktop is a great utility to aid in Time Management. It helps break tasks down into simple, bite-sized chunks.

My workplace has a simple policy. If your iChat status is set to DND (Do Not Disturb), people leave you alone completely. I have found that people stress out less about not being able to talk with me if they know when I will be available next. So, I wrote these simple scripts for Pomodoro Desktop to keep everyone in the loop.

NOTE: The delay 1 in the middle of the scripts works around a bug in iChat for Mac OSX 10.6.x. Without the delay, the status message does not always show.

START:
tell application "iChat"
	set status to away
end tell
delay 1
set timeStr to time string of ((current date) + (25 * minutes))
set Pos to offset of ":" in timeStr
set timeStr to (characters 1 thru (Pos + 2) of timeStr as string) & characters (Pos + 6) thru end of timeStr as string
set message to "DND - Available at " & timeStr
tell application "iChat"
	set status message to message
end tell
END:
tell application "iChat"
	set status to available
end tell
delay 1
set timeStr to time string of ((current date) + (5 * minutes))
set Pos to offset of ":" in timeStr
set timeStr to (characters 1 thru (Pos + 2) of timeStr as string) & characters (Pos + 6) thru end of timeStr as string
set message to "Available until " & timeStr
tell application "iChat"
	set status message to message
end tell
BREAK END:
tell application "iChat"
	set status to available
end tell
delay 1
set message to "Available"
tell application "iChat"
	set status message to message
end tell