Skip to content

Instantly share code, notes, and snippets.

@IanMulvany
Created January 4, 2017 17:41
Show Gist options
  • Save IanMulvany/aa22dcd2ff07a7bdb9aca0159cbff38b to your computer and use it in GitHub Desktop.
Save IanMulvany/aa22dcd2ff07a7bdb9aca0159cbff38b to your computer and use it in GitHub Desktop.
set now to (current date)
-- midnight this morning
set today to now - (time of now)
-- midnight tomorrow morning
set future to (today) + (336 * 60 * 60)
tell application "Calendar"
-- delete existing events in Sage Copy calendar
repeat with anEvent in (get events of calendar "sage")
delete anEvent
end repeat
-- find events in Outlook calendar that are happening in the next two weeks, and copy them to "sage"
repeat with anEvent in (get events of calendar "Calendar" whose start date is greater than or equal to today ¬
and start date is less than or equal to future)
copy anEvent to the end of events of calendar "sage"
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment