-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathThings to Reminders.applescript
85 lines (65 loc) · 2.13 KB
/
Things to Reminders.applescript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
tell application "Things"
set _projectlist to every project's name
set _workproject to my choosefromList(_projectlist, "Choose which Things project you want to export to Reminders")
my exportThingsProjets(_workproject)
end tell
on exportThingsProjets(_project)
tell application "Things"
set _projectlist to _project
set _items to every to do of project _projectlist
repeat with _todo in _items
set _name to name of _todo
set _note to notes of _todo
set _duedate to due date of _todo
set _status to status of _todo as string
tag names of _todo as string
_status
tell application "Reminders"
#set or create list
try
set mylist to list _projectlist
on error
set mylist to make new list with properties {name:_projectlist}
end try
tell mylist
#delete old reminders in list
#delete (every reminder whose name is name of _todo)
if _status is "open" then
if _duedate is not missing value then
make new reminder with properties {name:name of _todo, body:_note, due date:_duedate, remind me date:_duedate}
else
make new reminder with properties {name:name of _todo, body:_note}
end if
end if #_status is "open"
end tell #tell list
end tell
end repeat
end tell
end exportThingsProjets
on convertTags(_tags)
set _returntext to ""
repeat with i from 1 to count of _tags by 1
set _item to item _counter of _tags
set _returntext to "#" & name of item i of _tags & _returntext
set _counter to _counter + 1
end repeat
return _returntext
end convertTags
on stringToList(theString, myDelimiters)
tell AppleScript
if theString contains myDelimiters then
set theSavedDelimiters to AppleScript's text item delimiters
set text item delimiters to myDelimiters
set outList to text items of theString
set text item delimiters to theSavedDelimiters
return outList
else
return {theString}
end if
end tell
end stringToList
on choosefromList(mylist, myPrompttext)
choose from list mylist with title myPrompttext
set myResult to result as string
return myResult
end choosefromList