Activate a schedule at an unknown rate

Posted on
Thu Oct 23, 2014 12:47 pm
tornado offline
User avatar
Posts: 104
Joined: Jun 30, 2014

Activate a schedule at an unknown rate

Hi,

I would like to activate an applescript based on a schedule that varies when it fires.

Specifically I have a script that polls the location of my Tesla (I love the API they've exposed for it). The problem is that they only allow you to call the locate command a certain amount of times per minute. I would like to speed up and slow down my polling rate for the call based on the location of the car (ie, if it is close to the house and heading towards the house, to turn on the outdoor lights and open the garage door. If moving away from the house, slow down the poll rate, etc).

I have all this working however it is only working with an 'always-on' applescript that fires off another applescript based on a poll-rate variable. Instead of leaving the applescript always spinning checking the poll rate I'd rather fire off a schedule based on the next poll time but I'm not sure how to create that linkage. Any suggestions?

Thanks

Posted on
Thu Oct 23, 2014 5:44 pm
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: Activate a schedule at an unknown rate

If it were me, I would probably write a script that executes at the fastest possible poll-rate that I would ever want. Then inside that script I would make the determination based on previous polls whether or not to actually poll at that particular interval or wait until the next execution.

Posted on
Mon Oct 27, 2014 9:48 am
tornado offline
User avatar
Posts: 104
Joined: Jun 30, 2014

Re: Activate a schedule at an unknown rate

I was hoping to be able to get one fired off via the scheduler but yes I think that would work. Thanks for the tip.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest