Hi!
I read and searched the forum but I don’t quite get if what I want is possible. I’d like to quickly write notes on iOS, using Drafts or something alike. I want to write tags into the note and store it to the cloud. Then I’d like to automatically import those notes to DTP. (So far this should be possible) Then I’d like to auto-assign the tags from the body of the text to DTP. I only found the possibility to import them from the comments. Is there a way to do this?
It would be possible to Applescript it, but you should follow a strict convention for the Tags. Do you have an example?
Thanks!
What I hope to do is this: I get an idea. I write it down in Drafts 4 for iOS. I include one or more tags, using hashtags or whatever. I use a drafts action to export that file to dropbox or some cloudfolder. On my Mac, I was hoping to find a way to make the new notes import automatically into DTP, recognizing the tags and automatically assigning them to the document.
It would be okay if I had to restrict myself to predefined tags (even though it would be more convinient if I could make up new ones as well).
I can send my note to Devonthink to go and assign the tags there myself, but I was hoping I could skip that step if DT was able to read the tags I simply throw into the body of text.
Possible? Yes, but there are details to work out. Please start a Support Ticket. Thanks!
FWIW - this would be golden for me as well. If you manage to get this sorted, please pop something up!
I created the ticket. Thank you in advance, your great!
Sure!
Thanks again Jim!
For all other interested people: Jim wrote a script that automatically assigns tags to DTP documents. The tags have to follow the @symbol and start in a new line each. You simply select the document, then run the script.
I created a smart (dropbox-)folder that automatically imports new documents to DTP. So now I can create a note, e.g. in Drafts4, quickly add some tags within it (TextExpander!) and save it in that dropbox folder. It gets automatically imported to DTP. All that remains for me to do is select the new items in the Inbox, run the script and move them to my „notes“ group in DTP.
Ideas on automating even that last step are welcome, but it is really not that much of work.
Here is the script:
tell application id “DNtp”
repeat with thisRec in (selection as list) – Processes selected files in DEVONthink Pro / Pro Office
tell thisRec to set tags of thisRec to (tags of thisRec & (paragraphs of (do shell script “grep -e ^\@ " & (quoted form of (path as string) & " | sed ‘s_@__1’”))))
– This scrapes the text pulling the lines that begin with @, then it removes the first occurence of the symbol and adds them to the current Tags of the file
end repeat – Then moves on to the next file, or exits the loop.
end tell
Must be an error in transcription. When I used the script on a file that contains this text:
@bling
@blang
@blong
I get tags
blang\
bling\
blong)
That must not be the intent?
I installed it in a KM macro and tested it earlier today on a plain text document, and it works fine for me as is. Curious if perhaps you testing with another document format that could cause this?
Note this script is only meant for plain text files (and their variants, like Markdown - which is plain text under the hood).
For those who don’t feel like typing…
Drafts Tag Scrape and Apply.scpt.zip (2.41 KB)
Indeed, I wasn’t thinking and tried with a few RTFs. The script could be modified to work with RTF attributed run – -ugh, so tricky. It should probably do an error check and refuse to operate other than on plain text. All food for someone’s future hobby