Hourly chime...

Argh, I’ve just spent an hour checking out about a dozen alarm clock/reminder apps on VersionTracker, as I am wanting my Mac to chime on the hour rather than speak the time.

Surely this is easy to do with a little AppleScript? Or is it an automator thing?

Thanks for any help!

un

A week ago one has published a widget on www.dashboardwidgets.com which lets you define an interval and then plays a sound repeatly.
I just can’t remember the name of it!

Is it ProdMe? http://www.dashboardwidgets.com/showcase/details.php?wid=1226

Excellent, thank you!

:slight_smile:

Yes! That’s it!

Yeah, widgets are great and all, but this wouldn’t be a very good AppleScript forum if nobody even tried to write a script. :wink: Here is my attempt. Saved as a stay-open app.

on idle
	say "ding dong" using "Bells"
	set idle_time to (hours * (hours of ((current date) + hours))) - (time of (current date))
	if idle_time < 0 then set idle_time to days - (time of (current date))
	return idle_time
end idle

I just wrote that out of thin air, so I haven’t had enough time (har-har) to test it much. I’m running my system on a 24 hour clock but I don’t think that should make any difference. If you download this free faceless background application (http://microcosmsoftware.com/playsound/) you can do more “fun” things like chime off the number of hours since noon/midnight:

on idle
	set hour_count to hours of (current date)
	if hour_count > 12 then set hour_count to hour_count - 12
	tell application "Play Sound" to play (path to library folder from system domain as string) & "Sounds:Blow.aiff" repeat (hour_count - 1)
	set idle_time to (hours * (hours of ((current date) + hours))) - (time of (current date))
	if idle_time < 0 then set idle_time to days - (time of (current date))
	return idle_time
end idle

If nothing else, rolling one’s own simple applet can be a bit of fun. The suggestion below merely uses a plain beep - but it could, with the aid of a scripting addition or app, be easily modified to enhance the chime and become a faceless app. (In terms of playing sound, I see that silvermeteors has already suggested Play Sound - a small, speedy and most effective application written by David Blache.) :slight_smile:

Anyway, FWIW:

property chimeCount : 0

on idle
	repeat chimeCount times
		say "oo" using "Bells"
	end repeat
	tell (current date)'s time
		set chimeCount to it div hours mod 12 + 1
		hours - it mod hours
	end tell
end idle

set chimeCount to 0

Edit 1: calculation for the idle handler return value modified as suggested (below) by Qwerty.
Edit 2: beep replaced by voice-synthesised “chime” - courtesy jobu (also below)

Cool. That’s exactly what I was thinking (in so many words)

:lol: Nice one, silvermeteors. :smiley:

What I still can’t understand is why some wag once accused me of grunting in AppleScript… :wink:

kai, sorry to bother you, but couldn’t you also use:

hours - (time of (current date)) mod hours

.to get the remaining time left to the hour?

Better still, Qwerty. (More direct - and so shorter and faster). And in the context of the script, it’s even shorter:

Thanks for the suggestion (which I’ve incorporated into the script above). :slight_smile:

Yeah, sorry, I meant hours - it mod hours, it’s just that I didn’t want to post the whole script again. :slight_smile:

This sounds pretty good for a chime that doesn’t use ‘beep’ and doesn’t require additions or 3p apps…

(say "oo oo oo oo" using "Bells")

j

LOL!

you could also use:

say "doomb da doomb da dumb dee dee doo dee doo dumb dumb da doomb da doomb da doomb da doomb da doomb da doomb da doo " using "Cellos"

(that’s what “Cellos” sings in the System Preferences as preview)

That’s a neat idea, jobu. It effectively differentiates the “chimes” from the current alert sound - and still retains the vanilla flavour of the script. Duly incorporated - thanks. :slight_smile:

(BTW, for a lower, slower chime, I also tried: say “[[slnc 1000]]oooooo” using “Bells” :rolleyes:)