Every Other Day Triggering?

Posted on
Wed Jun 02, 2004 12:36 pm
HFTobeason offline
Posts: 297
Joined: Nov 07, 2003

Every Other Day Triggering?

I can't, for the life of me, figure out how to trigger an event every other day (14 day cycle). Any help would be most appreciated.

Posted on
Wed Jun 02, 2004 5:37 pm
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

(No subject)

You cannot specifically set it to anything other than every day. You can set it to every monday, tuesday, etc. I hear rumors that Matt wants to add this capability.

Posted on
Wed Jun 02, 2004 5:48 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: Every Other Day Triggering?

Greg is correct, there is no way to easily do this now and it is something I hope to have in v2.x. You could hack something together with AppleScript to do this now, if it is critical.

Regards,
Matt

Posted on
Wed Jun 02, 2004 5:54 pm
HFTobeason offline
Posts: 297
Joined: Nov 07, 2003

(No subject)

Okay, thanks - I guess I'll just wait for v2. Soon, I hope...

Posted on
Wed Jun 02, 2004 8:05 pm
lobster offline
Posts: 24
Joined: Mar 09, 2004
Location: Boca Raton, FL

(No subject)

In the meantime, you could create:
1) a variable named "everyOther" with value of "true", and
2) an everyday event with the following embedded applescript action:
set flag to (value of variable "everyOther" as boolean)
set value of variable "everyOther" to (not flag)
if (flag is true) then
     -- Do your action code here
end if


I think this should do what you want.

-John
-------------------------
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Posted on
Wed Jun 02, 2004 8:08 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

(No subject)

Hi John,

Good technique. What I was thinking of was much more involved and complicated than that.

Matt

Posted on
Wed Jun 02, 2004 9:24 pm
HFTobeason offline
Posts: 297
Joined: Nov 07, 2003

(No subject)

Thanks for the help. I'll try the Applescript. But please, Matt, don't _not_ put this functionality directly in v2...

Posted on
Wed Jun 02, 2004 9:29 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

(No subject)

Don't worry. AppleScript is great when you have a problem that should require its power, but I definitely think that you should not need to code in AppleScript just to have an action occur every other day. :D

Regards,
Matt

Posted on
Wed Jun 02, 2004 10:09 pm
HFTobeason offline
Posts: 297
Joined: Nov 07, 2003

(No subject)

Oaky - this is what I did, for anyone who cares...

I created a variable "every2ndDay" with value "true" (I'm going to work on every3rdDay, every4thDay, etc soon).

I created a Time/Date Action which runs every day at 00:01, and whose Action is to Execute an embedded Applescript which reads:

set value of variable "every2ndDay" to (not value of variable "every2ndDay" as boolean)

Now, I can have Time/Date Actions simply check the variable every2ndDay to determine if they should run or not - and I can have 2 events run on alternate days off the same variable.

I think this will work...

Posted on
Wed Jun 02, 2004 10:25 pm
HFTobeason offline
Posts: 297
Joined: Nov 07, 2003

(No subject)

Further work yields the following attempt to create an "every3rdDay" handler. Same basic setup as for "every2ndDay", except the variable has an initial value of "1". This is my stab at the Applescript code:

if value of variable "every3rdDay" is 3 then
set value of variable "every3rdDay" to 1
else
set value of variable "every3rdDay" to (value of variable "every3rdDay" +1)
end if

My goal is to be able to cycle through 1, 2, 3, 1, 2, 3, etc, and thus be able to test for 3rd days.

Sadly, this Applescript simply increments "every3rdDay" steadily - 1, 2, 3, 4, 5, 6... I'm obviously a putz, but I can't understand what I'm doing wrong.

Again, any help much appreciated.

Posted on
Thu Jun 03, 2004 6:34 am
lobster offline
Posts: 24
Joined: Mar 09, 2004
Location: Boca Raton, FL

(No subject)

Values of variables in Indigo are currently just text, so you'd have to do something like:
   if (value of variable "every3rdDay" as integer) is 3 then ...

when you set the value of a variable, the value is automatically converted (an attempt is made at least) to text, but unless you specifically cast the result of the 'get' to the type you want (in this case, integer) it will be a string.

Good luck,

-John

Posted on
Thu Jun 03, 2004 9:57 am
kyleputzier offline
Posts: 58
Joined: Dec 17, 2003
Location: So. California

(No subject)

I don't understand. Why not just trigger it every 48 hours?

Kyle

Posted on
Thu Jun 03, 2004 10:00 am
HFTobeason offline
Posts: 297
Joined: Nov 07, 2003

(No subject)

John - thanks for the advice. I solved the problem simply by putting the "3" in quotes:

Code: Select all
if value of variable "every3rdDay" is "3" then
   set value of variable "every3rdDay" to 1
else
   set value of variable "every3rdDay" to (value of variable "every3rdDay" +1)
end if


This seems to work, and now I can test for any day of a three-day repeating pattern.

Posted on
Thu Jun 03, 2004 10:02 am
HFTobeason offline
Posts: 297
Joined: Nov 07, 2003

(No subject)

Kyle - the 48 hour trigger won't work for me because I'm tying the triggers to sunrise/sunset, which obviously shift each day, and thus the 48 cycle would slowly drift away from sunrise/sunset.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests

cron