Hey,
So I'm one your 'via-MacZot' customers and was looking to use Clockwork as a platform for a few ideas.
However, at the first step, I'm hitting problems in using its (Apple)scripting abilities.
If I pull in the example script from http://www.hogbaysoftware.com/node/20, mainly:
tell application "Clockwork"
-- get selected timer
set t to selected timer
-- clear time, set to five minutes, set alarm mode and start. set display time of t to 0
set minutes of t to 5
set mode of t to alarm
set running of t to true
end tell
what happens is this:
1. the minutes get set to 5
2. the mode DOES NOT get set to Alarm (if it was Stopwatch)
3a. If the mode was already alarm before the 'set mode' then the step of 'set running' actually returns the value of alarm to 00:00:00 and thefore the alarm goes off immediately (as opposed to counting down from 5mins)
3b. If the mode was stopwatch before the 'set mode' the then the step of 'set running' actually changes the value of the stopwatch to 2082 days, 13 hours, 18 secs...and it starts counting up.
Any chance of a fix? I'm blocked at my first project !
The other thing is I've not managed to get the performAlarmAction stuff working yet either...but I've not collected the same level of info on it for your dissection.
Cheers,
Rob
In this case I think it's
In this case I think it's more the documentation that's broken and buggy. I recently made big changes to the way that applescript is supported, and unfortunately I made a number of changes that were not backwards compatible. I'll go update those scripts after this post, though you're likely to find a few other outdated ones around here if you look hard enough... please let me know when you run into them :)
In your script there are a few things to change.
First if the selected timer is running you need to first stop it or else you can change the mode or time (just like in the GUI). Setting the minutes just sets the minutes, it does clear out other fields, such as the seconds. The running property is now marked in the script dictionary as 'read only' and shouldn't be set, though applescript doesn't seem to enforce this. Here's a script that should do what you want I think, the big difference is the use of the start and stop commands to control the timer.
tell application "Clockwork"
set t to selected timer
stop t
set display time of t to 0
set minutes of t to 5
set mode of t to alarm
start t
end tell