Basic timer script

I know this will seem first grade to most of you, but I have only just gotten back into scripting after a several years ‘break in the action’. And I am having a bit of trouble with making things work in OS X. I need a simple script for a countdown timer. All I need is to have the script - saved as an app on my desktop - open up with a window that lets me set the time in hours, minutes and seconds. Then click the button and begin. Then at zero, I want it to set the system volume to maximum, open dialog window that says “Time is up”, begin playing the system beep over and over until I click the button.

For all of you who do this every day I am sure it sounds amazingly simplistic. For this old fart, who hasn’t written a script longer than 8 lines in several years it is a big deal. For those who are annoyed at this request, I apologize. And I am not on my home computer so I don’t have my script to copy and paste here. So any suggestions are appreciated, and I will post what I have done already when I get home this evening.

Much thanks,

You might look for Edward Hillenbrand’s Watch It on VersionTracker. It almost does what you want out of the box.

Thanks NovaScotian, Watch It does almost exactly what I want. I will go ahead and buy it so I can use it until I get my script done. I still want to do the script so I can ‘re-learn’ AppleScript. I am hoping to use it for a number of other things and this was my warm-up project. I thought it would be very simple. But I forgot who I was dealing with… me! :stuck_out_tongue:

I try to keep the learning process going at all times. But being busy all the time sometimes just gets me dizzy. Between a full-time job, running a part-time business (a hypnotherapy clinic), and learning to do web sites, and now getting back into AS, it sometimes seems that the faster I go the behinder I get.

Thanks again for the tip.


This might give you a few ideas, Jmax (although it won’t override computer sleep). Save it as a Stay Open application…

property reset : true
set reset to true
on idle
	if reset then
		set reset to false
				tell (display dialog "Enter a countdown time (hrs:mins:secs):" default answer "00:00:10")'s ¬
					text returned to tell (word 1) * hours + (word 2) * minutes + (word 3) to if it > 0 then return it
			on error number n
				if n is -128 then return quit
			end try
		end repeat
		set volume 7
			if not (display dialog "Time up!" buttons {"OK"} default button 1 giving up after 2)'s gave up then return quit
		end repeat
	end if
end idle

If you have installed Xcode, it should come with an example to do exactly that!