Below is a script that I’ve been using as a yoga timer. Basically it beeps every ten seconds, with special sounds every 30 sec, and every minute so that you know how long you’ve been doing a pose. But it still needs work.
(1) For one thing, the only way I could figure out (thanks to the developer) to play the system alert sounds by name was to use it with Extra Suites, but that is a problem since you can only distribute the script as a run-only script if you want to register Extra Suites, and I would like to distribute it as open-source so that anyone can edit the code.
Other issues are probably easier to solve:
(2) I would like to have a floating dialog throughout the script with a “Stop” button, that gracefully exists the script. It would re-set the volume, and also quit Extra Suites (not necessesary if I figure out how to do it without Extra Suites).
(3) I would like to determine the current system volume and then re-set it after the script exits, so that way the sounds can be clear (volume=5), but the user’s preferences won’t be permanently altered.
(4) It would be nice if the user could save preferences setting the interval time. This is more complicated since all the times are multiples of the basic interval - so it would be necessary to re-code all that depending on the interval chosen.
(5) Finally, right now the user can change the actual sounds used by the app, but it requires editing the script. It would be nice if these were set the first time the script is run, and then were saved, unless the user wanted to change them through some preferences…
As you can see - the script works, but there is a lot that could be done to improve it - I just don’t have the coding experience or skills to figure it all out. Any help or suggestions would be appreciated!!!
set interval_sound to alias "Macintosh HD:System:Library:Sounds:Hero.aiff"
set thirty_sec_sound to alias "Macintosh HD:System:Library:Sounds:Blow.aiff"
set minute_sound to alias "Macintosh HD:System:Library:Sounds:Submarine.aiff"
tell application "Extra Suites"
-- I need to get the current volume and save it.
set volume 5
play AIFF minute_sound
-- Currently goes for 200 minutes - ideally it should go continually until cancelled.
repeat with x from 1 to 200 by 1
repeat with i from 1 to 5 by 1
pause 600
if i = 3 then
-- If I can find another way to play AIFF sounds I don't need Extra Suites!
play AIFF thirty_sec_sound
else
play AIFF interval_sound
end if
end repeat
pause 600
play AIFF minute_sound
end repeat
set volume 3
-- I need to have a floating dialog to stop the process
-- it should reset the volume when quitting
quit
end tell