Hi,
I found a script that nearly fits my needs. Before Tagging with DT was possible, I used another tool to TAG my documents. These TAGs are shown within DT in the comment field. Now I’d like to safe my work and transform these comments in DT Tags. I am not an experienced script programmer. I modified this script and now it extracts exactly one tag out of the comments and converts them into a DT TAG. But this is done only for on item. It should delete the converted tag in the comments and process the next tags in the comments if there are any. The tags in the comments are separated with , and a blank. It looks like this: tag(Computer), tag(KnowHow), tag(Something)
etc. The number of tags is variable.
In my script are the following things missing: the iteration to process all the tags in the comment and the deletion of this old tags in the comments.
This is my script so far:
tell application “DEVONthink Pro”
set theSelection to the selection
repeat with theRecord in theSelection
-- extract the text between the two asterixes
set theText to comment of theRecord
set Start to offset of "tag(" in theText
set theTags to (texts (Start + 4) thru -1 of theText)
set Ende to offset of ")" in theTags
set theTags to (texts 1 thru (Ende - 1) of theTags)
-- split into single tags by semicolon
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ";"}
set theTagList to text items of theTags
set AppleScript's text item delimiters to od
--
set newTags to (parents of theRecord) & theTagList
set the tags of theRecord to newTags
repeat with theRecord in theSelection
end repeat
end repeat
end tell