Bulk tagging indexed files

Hi-

In DTPO 2.01, it appears that if you type a new tag into the “tag bar” at the bottom of the screen, it’s immediately exported to an indexed file as an OpenMeta tag.

If I select a group of indexed files, and drag them to a user tag in 3-pane view, I can bulk tag a group of indexed files, but the updated tag info is not exported as OpenMeta data.

Is this an oversight, something you’ll get to in a future revision, or something you have strong feelings against doing?

Thanks, Charles

Putting the buld-added tag back onto the original indexed files works for me when I synchronize the folder.

Hi Korm-

Not too clear on what you’re saying, but the files I’m working with are PDFs. If I drag a few into a tag group, the tag gets added, but nothing else has happened to trigger a re-index on synchronize. If I touch the mod date on one of the files, still nothing.

Perhaps you could check your procedure, or expand a bit on what you’re doing right?

(Of course it’s certainly possible to script the behavior I want.)

Thanks, Charles

You can attach a script (in the info pane) to any groups that are indexed to initiate a sync when the group is viewed/changed. There is a script to do this included in the Extras folder in the DTPO download. From the documentation:

Synchronize: Triggered script that synchronizes the item it is attached to each time it is viewed. Can be used to keep a group always synced with its counterpart in the file system.

Have you actually verified that the tag is exported from another application supporting OpenMeta? Sure isn’t working for me here with 2.01…

Anyway, I’d rather write a single script that did the update than deal with attaching a script to hundreds of tag groups.

Sorry, I mashed up my last post. I was trying to say I didn’t get the same result as Charles, and that synchronize was posting open meta tags correctly to the file (which I confirmed in Yep). Now that I tried it again, with PDFs and JPGs, all the tags are disappearing when I synchronize.

Definitely something odd happening.

I just tried it on some JPGs and PDFs and the results are flaky. All files write the first tag to the document without need to sync. For PDFs, it looks like I can add a second tag and it too syncs. However, I can only get one tag to stick with JPEGs. The second tag does not appear, unless I delete the tag that does appear.

Yeah, that sounds like my results as well.

But to get back to the original question, because it seems that bulk update of OpenMeta tags for indexed documents isn’t supported, is whether it’s an oversight, on the development timeline, or the DEVONtechnologists believe it shouldn’t be implemented.

As I said, this isn’t hard to fix with a script, but I’m always interested in what the creator’s have on their minds…

Best, Charles

I can add a tag to multiple indexed files using the tags bar and they are applied to the original files. Confirmed with Leap.

Adding a tag to multiple indexed files by dragging them to a tag in Tags does not apply the tag to the original files.

Adding a tag to multiple indexed files using the following script does work (also confirmed with Leap).

Probably a bug.

tell application id "com.devon-technologies.thinkpro2"
	try
		set these_items to the selection
		if these_items is {} then error "Please select some contents."
		set thePrompt to "Enter Text to Append to Tags (One Tag at a Time, Please)..."
		set theQuestion to display dialog thePrompt default answer ""
		set theAppend to text returned of theQuestion
		repeat with this_item in these_items
			set the_tags to the tags of this_item
			set newTags to the_tags & theAppend
			set the tags of this_item to newTags
		end repeat
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

The script is just an on-the-fly utility.

Ah, stupid me! Certainly Christian would have figured to enable the tags bar for a multiple selections.

The thing I’m now bothered by is that I can’t seem to delete OpenMeta tags from indexed files using the tags bar; I thought I could earlier today, but now, no such luck…

Korm, you might be amused by my “bulk tag script”: It takes multiple selections from the “Groups & Tags” window and multiple selections in a think/viewer window to do its stuff:

-- Takes possibly multiple source selections in a DTPO database,
-- and possibly multiple selections in the "Groups & Tags" window;
-- then tags source to targets.


tell application "System Events"
	tell process "DEVONthink Pro Office"
		set selState to selected of rows of outline 1 of scroll area 1 of window "Groups & Tags"
		set selName to value of text field 1 of rows of outline 1 of scroll area 1 of window "Groups & Tags"
	end tell
end tell

set targetTags to {}
repeat with i from 1 to count of selState
	if item i of selState is equal to true then
		set end of targetTags to item i of selName
	end if
end repeat

set existingTags to {}
tell application "DEVONthink Pro"
	set sourceRecord to (selection as list)
	repeat with i in sourceRecord
		if (count of tags of i) is not 0 then
			set existingTags to tags of i
		end if
		repeat with j in targetTags
			set end of existingTags to j
		end repeat
		set tags of i to existingTags
		set existingTags to {}
	end repeat
end tell

(For those of you that are thinking of using this, be sure you work on a COPY of your data. Don’t blame me if you screw up your precious data with the above!)

Best, Charles

Thanks, Charles. Afraid I’m having a bit of trouble making it work (due to my extraordinarily fat fingers no doubt :cry: )

It’s worth mentioning (as has been before in the Forum) that DT doesn’t write OpenMeta tags to documents inside the database (imported documents or those created in DT) until the document is exported. Would be helpful for those of use who use 3rd party OpenMeta browsers it the tags were written right away when added/changed/deleted, etc.

Like this?
bulktag.png
(It may be, given a lot of tags, that the script is taking forever building its selection list.)

In any event, given that the tag bar (and also the info window) enable bulk tagging, I won’t go farther with that variant of the script. Removal of tags from external documents is more pressing to me.

I should mention that my interest in tags (at the moment) is more limited than yours. I simply want to be able to synchronize DTPO tags and Bibdesk keywords, which I’ve achieved. Not sure how I feel about global use…

Thanks for your interest!

Charles

Usually DEVONthink supports OpenMeta only while im/exporting (also via drag & drop now) and indexing & synchronizing. OpenMeta tags of indexed files/folders are also updated after changing tags via the Tags bar or Info panel.

However, commands like moving/renaming/grouping/ungrouping/replicating do not update OpenMeta tags of indexed files/folders as this could easily cause almost endless updating of extended attributes followed by almost endless indexing by Spotlight.

To make a long story short - basically we’re using OpenMeta only as a way to interchange tags. As a storage it’s… well… not perfect.

After the crashing around I was doing over the weekend settled, it does appear that DTPO will add/remove tags via the tags bar, and also via Applescript. This is more than suitable for my needs.

Thanks Christian!

You’re right, I forgot to mention setting tags via AppleScript. That’s also updating OpenMeta tags of indexed files/folders.