I meant to mention that this script is not particularly robust, and only briefly tested shortly after waking up and writing it.

That said, I cannot reproduce the error. I have placed on my desktop a file: Untitled.txt, created a new Tb document, a note; dropped the file onto the sidebar for the note, and then inserted the above action as a Rule. If you inverted the last two steps---that might be the issue.
Another problem is---yes we are pushing Tb. Part of why that regex is such a mess is that I had to escape stuff to get past Tinderbox's internal parsing. I think the command is a little fragile. If I paste it into Rule verbatim, with nothing else, it works. That rule by itself would be needlessly expensive, adding some logic to only run sed when necessary would be best, but putting the URL command into a logic block does not work. It needs to have the part sent to the shell wrapped in quotes. I never got just [font="Courier"]file://[/font] as a result, though. Whenever it malfunctioned in my test---URL came up empty.
Oh, one other limitation is that files cannot be linked from other disks, obviously, as the prefix would then need to retain the volume name, and look like [font="Courier"]file:///Volumes/volumeName/path/to/file.txt[/font]. So a better version would be:
Code:if (File!="") { URL|=`"echo -n $File | sed -E 's/:/\\//g\;s/ /\\\\ /g\;s/^/\\/Volumes\\//' | tr -d '[:cntrl:]'" } else { URL=; }
ViewInBrowser also works for me---but if all you want to do is open the file, the File drop-down in the sidebar will accomplish that, and AutoFetchCommand would be a better way keep the note up to date.
Since that does not need the URL stuff, like the [font="Courier"]file://[/font] prefix, the final recipe would look like this.
Create attribute
FileUNIX(string)
Rule: [font="Courier"]if (File!="") { FileUNIX|="'" +runCommand("echo -n $File | sed -E 's/:/\\//g\;s/ /\\\\ /g\;s/^/\\/Volumes\\//' | tr -d '[:cntrl:]'") + "'" } else { FileUNIX=; }[/font]
AutoFetchCommand: [font="Courier"]Text=`cat $FileUNIX[/font]
AutoFetch:
trueOkay, now drag a file to the drop-spot (or browse to it, whatever). Close the note, open it again---should have file contents in the Text area. Use the drop-down to edit the file in TextMate. I believe this is the work-flow you are looking for, Gilbert? The contents of the Tinderbox note will always be up to date with the disk; the file can be easily opened and edited in TextMate without knowledge of the file system; and the files can then be organised using Tb's extensive features.
This will work for files on external volumes, files with spaces, and it should work for files with Unicode characters---but I didn't test that.