Python Script:
- Code: Select all
import time
import applescript
path_to_script_file = "/Users/Rick/Scripts/Calender Today.scpt"
my_ascript_from_file = applescript.AppleScript(path=path_to_script_file)
indigo.server.log("Checking if hoiday...")
reply = my_ascript_from_file.run()
if reply:
indigo.variable.updateValue("holiday", value="true")
indigo.server.log("hoiday set to true")
else:
indigo.variable.updateValue("holiday", value="false")
indigo.server.log("hoiday set to false")
AppleScript:
- Code: Select all
set theDestCalendar to "House"
-- set startDate to date ((date string of (current date)) & " 00:00:00 am")
set startDate to (current date) -- (24 * 60 * 60)
set hours of startDate to 0
set minutes of startDate to 0
set seconds of startDate to 0
-- set endDate to (startDate + 2 * (24 * 60 * 60))
set endDate to startDate + (1 * days) - 1
tell application "Calendar"
set theEvents to events of calendar theDestCalendar whose start date is greater than or equal to startDate and start date is less than or equal to endDate
repeat with theItem in theEvents
set eventTitle to summary of theItem
-- say eventTitle
if eventTitle contains "Holiday" or eventTitle contains "Vacation" then
return true
end if
end repeat
return false
-- set eventTitle to summary of (item 1 of theEvents)
end tell