C-Command Software Forum

Best Practices for Code Snippets

I’m a long-time Yojimbo user and recently migrated to EF. I’ve not had very good luck finding tips in the forum about changing EF’s overly strong (imho) preference for “rich text”. Specifically, the Import from Clipboard command on the Dock icon (I use a mouse as little as possible and keep reaching for the keyboard shortcut for this function) insists on creating an RTF document, even if the clipboard’s contents is not RTF.

EagleFiler also complains loudly if I, for example, create a new document in TextMate, type some text, select it, then use EF’s Capture key. The capture script, as written, throws up an alert and insists on importing a file. I’d prefer that EF be smart enough to realize I have selected text to “capture”, creating a new record (plain or rtf, depending upon the type on the clipboard) on its own.

I understand how the different models of Yojimbo’s database store vs. EF’s file store are adding to my pain, but I’m looking for ways to enhance EF’s plain text support anyway! :wink:

I’ve reviewed the preferences and esoteric preferences but don’t find anything particularly helpful.

Has anyone been successful in revising the com.macromates.textmate.scpt (or other Capture Scripts, for that matter)? I know how to write scripts (applescript/rb-appscript/shell/kbd macros/etc.) and I will if I have to (and fully understand the implications with altering resources in the app’s bundle), but I thought I’d listen to how others might have “beefed up” EF’s plain text and clipboard handling. I don’t want to re-invent wheels or spend a lot of time scripting if I’m missing a workflow pattern that’s clearly obvious to others.



I’ve got a feature request logged to handle this better. Unfortunately, I think it needs to be a preference because there are strong opinions both ways.

TextMate doesn’t make the window’s text available to AppleScript. You should be able to import the selection via the Services menu (or Command-%), however. Or drag and drop.

If you really don’t want to use the service, you could probably do this via AppleScript by copying the text to the clipboard and then telling AppleScript to read the clipboard. (This will, alas, clobber anything that was previously on the clipboard.)

There’s no need to alter anything in the bundle. You can save a script with the same name in:

/Users/<username>/Library/Application Support/EagleFiler/Capture Scripts/

and that will override the built-in script.

EagleFiler 1.5.7 adds the PrefersRichText esoteric preference, which lets you control whether text is imported as plain text or RTF.

Thanks, Michael. This works very well for me with selected text in TextMate using Services => EagleFiler: Import, or Services => EagleFiler: Import With Options, or [with copied text] the Dock icon’s Import Clipboard item.

And using QuickCursor from within EF’s content pane lets me update the text using TextMate, too.

Very nice. Thanks again!