I am trying to create an applet which takes the selected items in the Finder and creates a ist of RTF links in the clipboard, using AppleScript.
The code is :
tell application "Finder" to set s to selection
set r to "{\\rtf1"
repeat with i in s
set t to "Download " & name of i
set p to POSIX path of (i as text)
set sed to "echo " & quoted form of p & " | sed s_/Users/0/Dropbox/Public_http://dl.dropbox.com/u/DBid_"
set l to (do shell script sed) & "?dl"
set r to r & "{\\field{\\*\\fldinst{HYPERLINK \"" & l & "\"}}{\\fldrslt " & t & "}}\\par "
end repeat
set r to r & "}"
set fc to "echo " & quoted form of r & " | pbcopy"
do shell script fc
Everything works great, except the final "echo" to "pbcopy".
The backslashes get mangled and interpreted as escape codes instead of RTF codes!
I tried copying the final value of var fc manually, and pasting it in Terminal, and that worked great.
But when it comes from AppleScript, the "\" get sent as "\\" and it breaks the RTF codes.
Thanks for any help!
sedsubstitution? – Daniel Beck Feb 15 '11 at 20:02