View unanswered posts | View active topics It is currently Thu May 23, 2013 9:16 am



Reply to topic  [ 5 posts ] 
 Setting alarms via a control page 
Author Message

Joined: Aug 16, 2007
Posts: 4
Post 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


Thu Aug 30, 2007 11:20 pm
Profile

Joined: Aug 16, 2007
Posts: 4
Post 
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


Fri Aug 31, 2007 12:14 am
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11692
Location: Texas
Post 
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


Sat Sep 01, 2007 9:29 am
Profile WWW

Joined: Aug 29, 2008
Posts: 2
Post 
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? :)


Tue Oct 21, 2008 3:58 am
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11692
Location: Texas
Post 
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)


Tue Oct 21, 2008 7:09 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: Heritrix [Crawler] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.