Setting alarms via a control page

Posted on
Thu Aug 30, 2007 11:20 pm
Skaffen offline
Posts: 4
Joined: Aug 16, 2007

Setting alarms via a control page

Hi all,

I'm trying to make an alarm that can be set via a control page and wondered if anyone had any ideas about the best way to do this. I currently have a page that can be used to set the hours and then the minutes (in 15 minute blocks) by pressing some +/- buttons. The plan was then to have an applescript that turns those variables into a single time variable. The next step was to set a time/date action that runs every 15 minutes and sees whether the time variable equals the current time, and if so run an action group.

I think that that should all work but it seems a bit messy. Does anyone know of any better way?

At the same time can I put in a feature request for time/date actions to be editable from control pages!

Thanks for any help,

Skaff

Posted on
Fri Aug 31, 2007 12:14 am
Skaffen offline
Posts: 4
Joined: Aug 16, 2007

(No subject)

Well, made a bit of progress. Using some buttons and a few variables (AlarmHour and AlarmMinutes) I can change the time on a group using the following:

set timeHours to value of variable "AlarmHour" as number
if timeHours < 10 then
    set timeHours to "0" & timeHours
end if
set timeMinutes to value of variable "AlarmMinutes" as number
if timeMinutes = 0 then
    set timeMinutes to "00:00"
else
    set timeMinutes to timeMinutes & ":00"
end if
set dateString to "Friday, August 31, 2007 " & timeHours & ":" & timeMinutes
set absolute trigger time of time date action "TestTime" to date dateString

Posted on
Sat Sep 01, 2007 9:29 am
matt (support) offline
Site Admin
User avatar
Posts: 21426
Joined: Jan 27, 2003
Location: Texas

(No subject)

Hi Skaff,

Looks good to me. Another approach, if you want to set the Time/Date Action to be offset from the *current time* (I don't think that is what you want in this case though) is to use the "current date" value the system provides. Here is an example.

Regards,
Matt

Posted on
Tue Oct 21, 2008 3:58 am
SteveB offline
Posts: 2
Joined: Aug 29, 2008

(No subject)

I'm trying something very similar, but (due to delayed actions), want the date/time action to be activated 12 minutes before the time specified.

set datestring to datestring - 12 doesnt seem to work, as datestring is not a number.
I attempted this coding, but didnt seem to have much luck :
set timeMinutes to timeMinutes - 12
if timeMinutes < 0 then
set timeMinutes to 60 + timeMinutes
set timeHours to timeHours - 1
if timeHours = -1 then
set timeHours to 23
end if
end if

and set timeString to timeString - (date "Tuesday, October 21, 2008 00:12:00") auto enters todays date when compiled, so i'm not convinced this will work effectively tommorow.

What i want to do is probably really simple. Any help? :)

Posted on
Tue Oct 21, 2008 7:09 am
matt (support) offline
Site Admin
User avatar
Posts: 21426
Joined: Jan 27, 2003
Location: Texas

(No subject)

Look at the example I linked to above. Something like this:
Code: Select all
    set triggerTime to current date
    set triggerTime to triggerTime - (12 * 60)
    ...
    set absolute trigger time of time date action "TestTime" to triggerTime

Regards,
Matt (Indigo Support)

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest