Forked from IskenHuang/things-to-fantastical.applescript
Created
September 2, 2021 07:03
-
-
Save BH1SCW/f0ce00ea942656bd04054ecd309f6c04 to your computer and use it in GitHub Desktop.
Things3 complete todos create calendar event to fantastical.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
## Goal | |
This script is make new calendar event to fantastical2 from things3 complete todos in 'Logbook' on specified date. | |
## How to use: | |
* Default is today | |
* `$ osascript things-to-fantastical.applescript` | |
* The specified date | |
* `$ osascript things-to-fantastical.applescript 2017/08/12` | |
*) | |
on run argv | |
tell application "Things3" | |
set todos to to dos of list "Logbook" | |
set onDate to current date | |
set shallArgv to item 1 of argv as text | |
if shallArgv contains "/" then | |
set onDate to date shallArgv as date | |
end if | |
set onDateString to "" & month of onDate & " " & day of onDate & " " & year of onDate as text | |
repeat with todo in todos | |
set myNote to notes of todo as text | |
set query to "" & "'> " & name of todo & "' " & completion date of todo as text | |
set title to "" & "'> " & name of todo & "' " & onDateString as text | |
set calName to "Work" as text | |
set myArea to area of todo | |
set myAreaName to "" as text | |
try | |
set myAreaName to "" & name of myArea | |
end try | |
if myAreaName contains "Life" then | |
set calName to "Life" | |
end if | |
if query contains onDateString then | |
tell application "Fantastical 2" to parse sentence title notes myNote calendarName calName with add immediately | |
delay 2.0 | |
end if | |
end repeat | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment