Craig,

If you drag and drop a text file on to an open bbedit doc it will insert the 
contents at the cursor. 
But if you hold the cmd key it will insert and select a path.

You could then run a script to encode it.

Here is an example that works for me but I haven’t tested much. 
Install it into BBEdits Scripts folder if want to give it a try.


Make File URI.applescript
—————————————

tell application "BBEdit"
        tell window 1
                set _path to selection as text
                set _cmd to "ruby -rURI -e "
                try
                        set _uri to do shell script _cmd & quoted form of 
("puts URI.join( \"file:///\", URI.escape(\"" & _path & "\".chomp) )")
                on error
                        set _uri to _path
                end try
                set selection to _uri
        end tell
end tell

——————————————

It will change this (the dropped path):
/Users/chris/Desktop/untitled text 10.txt

Into this:
file:///Users/chris/Desktop/untitled%20text%2010.txt

Food for thought:

BBEdit has something called Attachment Scripts that allow you to invoke a 
script on an event. 
Page 343 from the user manual ( found in the Help menu ).

I don’t think they have an attachment point for dropped text files, they 
recently added one for dropped image files.
But you could have an attachment script run a text filter and convert all the 
paths in the doc into file URIs when you save or something.

Best of luck with your workflow,
Chris(topher)?



-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/BD10F8EB-ADCB-410F-B634-4048AA8B4C1B%40rustydogink.com.

Reply via email to