C-Command Software Forum

Finder import that preserves comments?

Summary: I love your app. I can’t figure out how to Finder import and preserve comments. Workaround tip? If not: consider adding “preserve” checkbox to future Finder import dialog?

First, a rave: I’m very much enjoying my EagleFiler demo - heading towards “passionate” about it, particularly the Finder-based (iApp-style) archive. I use a lot of software, I have a lot of data, and migration/integration issues are a constant headache - letting me use my file system directly is a huge, huge win over (insert list of a dozen other document organization apps).

My use context: I currently use Finder/Spotlight comments for a variety of file-system level tagging purposes, including status tags meant to be picked up by smart folders, storing the source URLs of downloaded files, and adding useful search term tags via Quicksilver. Yes, I know Spotlight comments are brittle, and I understand why developers hate leaving their data lying out in DS files, and I’d much rather be tagging using some kind of pumped up SpotMeta+Pathfinder combination, and I know that OS 10.5 (or 10.6) may usher in a metadata nirvana. Right now, however, Spotlight comments are easily writeable and readable by a wide variety of applications, so data put there can do work. Anyway.

My problem: I want to import a few thousand documents in Finder - but EagleFiler deletes the Spotlight comments when doing Finder imports. It offers three choices - “Ignore” “Import as Tags” “Import as Notes” - all of which strip the comments (I at first assumed “Ignore” would leave them). The only solution I’ve hit on is to copy out the Spotlight comments, import the file into Eagle Filer, then restore the comments in Finder - a workflow that makes the prospect of mass import pretty daunting. If I thought I could power through 1000 documents and then never deal with it again, I wouldn’t mind, but it seems like this would be an ongoing workflow problem. Again, the reason losing them is a concern is that it breaks the Finder integration that EagleFiler largely offers - if I import items, they disappear from other smart folders apps and contexts etc. because their comments got stripped.

I’m hoping for some way around this - perhaps just a checkbox on the dialog “Preserve Spotlight comments” - so that the files will continue to function with the variety of other apps that use them. I’m assuming (perhaps incorrectly) that they aren’t stripped to aid any particular functionality of EagleFiler, but rather as a good practice to avoid duplication of information and potential syncing problem, as EagleFiler tags/notes and Spotlight comments could be out of sync. If this is the case, a few brief arguments from my point of view on why data duplication might be permissible here: a) this problem exists anyway (you can already comment your imported EagleFiler documents files in Finder), b) this can be solved by expectation management (the EagleFiler tags are official, if advanced users choose to leave spotlight comments then the legacy info isn’t EagleFiler’s problem), c) sync can be partly solved in the future by poor-man’s-sync scripts such as use-selected-item-tags-to-overwrite-spotlight-comments or “delete-spotlight-comments-from-library”, and d) a general strategy for exporting tags in some form attached to the item (either on touch, on export, or on demand) might not be such a bad thing - tags are currently the only un-exportable part of EagleFiler I know of.

The OS routine that EagleFiler uses to copy files into the library does not preserve the Spotlight comments. Perhaps I can work around this for a future version.

EagleFiler 1.2 adds an option to automatically copy the EagleFiler tags into the Spotlight comments. So you could, for example, let EagleFiler import the Spotlight comments as tags when you capture from the Finder, and then EagleFiler will write the tags back out to the comments after the file is copied into the library.

How tag import-export breaks: commas, prefixes, URLs etc.

You could, for example, let EagleFiler import the Spotlight comments as tags when you capture from the Finder, and then EagleFiler will write the tags back out to the comments after the file is copied into the library.

I’m really excited that you’ve added tag export! (and embarrassed that I requested it hours before you posted this obviously long-planned feature). Unfortunately the feature as implemented won’t work at all for me - I’ll have to do it manually for each item.

If you decide to extend these features in the future, here (for information purposes) is a single tagged file moving through a workflow and where things fall down.

  1. I download a file (e.g. foo.bar), and the Safari plugin DownloadComment automatically adds the source URL to Spotlight comments:

http://www.source.com/foo.bar

  1. I add some tags, either manually or in Quicksilver using the file tagging plugin. Like other applications in the space (TagBot, Punakea, etc.) Quicksilver parses tags in the comments space by using a prefix character, so that it doesn’t confuse other information with tags when adding, deleting and searching - in this case, the prefix is ‘&’. I open Quicksilver and type the tags “test example” and my comments now reads:

http://www.source.com/foo.bar &test &example

  1. Later I decide to import into EagleFiler, and choose import-to-tags. My EagleFiler tags are now:

&test &example bar com foo http source www

The URL is arguably my fault - I imported it as tags rather than notes, and it isn’t a tag. Still, good to see what happens since the import dialog doesn’t show the comments content before import - mistakes happen. The URL is not only dead, but exploded into the tag space. Luckily, in this particular case using Quicksilver prefixes keeps the junk from mixing with the good tags, so cleanup should be relatively easy - excepting collisions like if I already have a tag in EagleFiler called “source,” or an Amazon URL generating ~100 bad tags.

  1. I export the tags to Finder - although my EagleFiler prefs are set to copy tags to Finder, my spotlight tags show as empty. Closing and reopening EagleFiler and adding a tag in the bottom pane doesn’t change that - it seems like touching the file with Option-Apple-I works, but I’m not totally positive what triggers a Spotlight comment write. After a bit of poking, though, it happens. The comments were originally:

http://www.source.com/foo.bar &test &example

and are now:

&test, &example, bar, com, foo, http, source, www,

In fact, the leftover smashed URL isn’t a huge problem, because other tag software like Quicksilver can ignore anything not prefixed with &. Instead, actually big problem turns out to be the added commas. Quicksilver (like Pukanea and Tagbot? I think??) and my smartfolders now think I have 50 files tagged “example” and 1 file tagged “example,” with a comma, which is a different tag.

If you were interested in adding tag import-export preferences, my thought would be:

  • Basic support: an optional delimiter preference (e.g. comma or space) so that pre-existing Finder tags of other apps aren’t changed.
  • Advanced support: add an optional (could be blank) user-defined prefix preference (e.g. &)
    – With a prefix you can throw away non-tags on import rather than accidentally polluting the tag space… or even import the tags, then put non-tags in notes! Non-tag comments will still be lost from Finder comments, but they won’t be destroyed.
    – With a prefix you could optionally pretty import-export like tagging apps - e.g. the spotlight “&example” imports as “example”, and “example” exports as “&example”

Note that none of these suggestions require implementing sync or a guarentee that Spotlight comments will be 100% preserved. They just help EagleFiler save most of the information it gets and play nice with other tag apps.

Thanks for the comments. I’ll have to think about what to do here. In the meantime, if you know AppleScript, you could probably get pretty far by editing EagleFiler’s capture script for the Finder (and saving it in ~/Library/Application Support/EagleFiler/Capture Scripts/). You could make it look for URLs in the comments and set them as the source URL (or note) and remove the ampersands in front of the tag names.

Thanks. If I come up with something I’ll post it here.

Is the tag export controlled by an applescript as well, so that I can remove the exported commas? I couldn’t find it in the package contents, but I might be looking in the wrong place.

After reading the documentation I see that I haven’t yet added support for setting the source URL when capturing, so for now you’ll have to ignore that suggestion above and instead put it in the note.

No. I’d have to add a preference for that. But I think I may just change the separator to a space.

When does EagleFiler write Spotlight comments?
When does EagleFiler write to the Spotlight comments field of a file? I’m assuming that it happens on one or more of these events…?

  • on quit?
  • on metadata backup routine?
  • when the tags of an entry are edited?
  • when an entry is edited in any way?

When the library is opened and periodically (every two hours, at present, but I may change this) thereafter.

EagleFiler 1.2.1 will let you manually copy the tags to the comments by choosing Backup Metadata. It also lets you set the title and source URL when capturing, preserves Spotlight comments when copying files into the library, uses space as the tag delimiter in the comments, and lets you set a tag prefix character when exporting.

How to import a note
Michael - You suggest putting the URL in a note during import. How? I see there is an “import note” action in the Eaglefiler Applescript dictionary, but I have not been able to figure out how to use this to attach a note to an object I am importing.

The import command works like:

import files {"/path/to/a/file"} note "your note text"

However, this is not used when writing a capture script. Instead, you would include the URL in the |sourceURL| or |note| field of the record that your capture script returns.

Great!
Got it - it works great - thanks! I have a mail.app rule set up to run a script when a message is sent to a particular address. If the subject line looks like a URL, the script imports the web page to EagleFiler and uses the body of the message as the note:

using terms from application "Mail"
    on perform mail action with messages theseMsgs
        repeat with thisMsg in theseMsgs
            set theSubject to the subject of thisMsg
            set theBody to the content of thisMsg
            if text 1 through 7 of theSubject is "http://" then
                tell application "EagleFiler"
                    tell library document 1
                        import URLs theSubject note theBody
                    end tell
                end tell
            end if
        end repeat
    end perform mail action with messages
end using terms from

Cool! Just out of curiosity, is there some strange reason why:

if theSubject begins with "http://" then

doesn’t work in this script, or were you unaware of that option?

Actually, this is only half of the script. If the subject line does not start “http://” then I assemble the subject and body, along with date info, and import that as a text item.

EagleFiler 1.4 can import tags and notes from the Spotlight comments, regardless of the import method.