Schedules via Python - last bit of AppleScript

Posted on
Wed Oct 09, 2019 3:43 pm
TimH offline
Posts: 3
Joined: Mar 06, 2008
Location: Los Gatos, CA

Schedules via Python - last bit of AppleScript

I am down to one piece of Apple Script that remains before I am fully on Python. I use AppleScript to create the schedule each day to fire at "PreWakeTime" to begin to prepare my home. It uses this script snippet

Code: Select all
[i]   -- Make a new Time Date Action to begin the wake up sequence
   make new time date action with properties {name:"Wake Up Sequence", description:"Wake Up Sequence", time trigger type:absolute, date trigger type:absolute, absolute trigger time:PreWakeUpDate, days of week:"1111111", auto delete:true}
   tell first action step of time date action "Wake Up Sequence"
      set action type to modifyVariable
      set variable name to "Bedtime"
      set variable value to "No"
   end tell
[/i]

So when it hits the PreWakeUpDate (date/time) the schedule fires and sets the Variable Bedtime to "No" and the other triggers take over. In the mean time, I guess I could create a polling schedule that runs every 30 secs and checks if the current time equals "PreWakeUpDate", but is there any way yet to create schedules in Python with 7.4? Its been a hold out for some time and still says unimplements in the IOM? Anyone found other work arounds?

Posted on
Wed Oct 09, 2019 4:23 pm
FlyingDiver offline
User avatar
Posts: 5321
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Schedules via Python - last bit of AppleScript

How does "PreWakeUpDate" get set? How often does it change?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Oct 09, 2019 4:34 pm
TimH offline
Posts: 3
Joined: Mar 06, 2008
Location: Los Gatos, CA

Re: Schedules via Python - last bit of AppleScript

Thanks for the response. I just implemented a crude poll on the time every 29secs... so I have a hack that works. To answer your questions, it gets set either by default once per day just after wakeup or manually - essentially I can set the desired next wake up time manually before I hit the "good night" button or anytime during the day on a control page.

Posted on
Wed Oct 09, 2019 4:52 pm
FlyingDiver offline
User avatar
Posts: 5321
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Schedules via Python - last bit of AppleScript

In that case I think your solution is probably correct. Use a repeating schedule of 1 min or less, test the time in the conditions tab, then run the actions.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest