This repository was archived by the owner on Sep 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtagify.applescript
More file actions
41 lines (37 loc) · 1.37 KB
/
tagify.applescript
File metadata and controls
41 lines (37 loc) · 1.37 KB
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
tell application "Things3"
set inboxToDos to to dos of list "Inbox"
repeat with inboxToDo in inboxToDos
set AppleScript's text item delimiters to " "
set title to name of inboxToDo
-- set AppleScript's text item delimiters to " "
set theWords to {}
set theWords to every text item of title
-- If there are tags
if (offset of "#" in title) > 0
set theTags to {}
repeat with aWord in theWords
if (offset of "#" in aWord) = 1
set AppleScript's text item delimiters to aWord
set titleLst to title's text items
set name of inboxTodo to titleLst as text
set title to name of inboxToDo
set AppleScript's text item delimiters to ""
set aWord to text 2 thru -1 of aWord
copy aWord to end of theTags
end if
if (offset of "@" in aWord) = 1
set AppleScript's text item delimiters to aWord
set titleLst to title's text items
set name of inboxTodo to titleLst as text
set title to name of inboxToDo
set AppleScript's text item delimiters to ""
set aWord to text 2 thru -1 of aWord
move inboxToDo to area aWord
end if
end repeat
set AppleScript's text item delimiters to ", "
set tag names of inboxToDo to (theTags as text)
set AppleScript's text item delimiters to ""
end if
end repeat
end tell