Re: Applescript & RTF & TextEdit...
Re: Applescript & RTF & TextEdit...
- Subject: Re: Applescript & RTF & TextEdit...
- From: Jean-Christophe Helary <email@hidden>
- Date: Wed, 19 Apr 2017 07:12:49 +0900
Thomas,
Thank you for the suggestion. I need to work in TextEdit on an RTF file so switching to editing the code in a text editor won't work. But for now, the only thing I really needed was adding a "proper" link and I have 2 solutions at the moment, Shane's and a command line conversion that involves textutil, both of which I can eventually put in an Automator service if necessary.
I know how RTF works, I used to do tests between LibreOffice/Word and other versions, working through the details with the Oreilly Pocket Reference. When you see that, you understand why MS had to come up with such a convoluted way to XMLize its office file format...
Jean-Christophe
On Apr 19, 2017, at 0:57, Thomas Fischer < email@hidden> wrote:
Jean-Christophe,
RTF is a markup language like HTML, so you can change it with any text editor (I prefer TextWrangler or BBEdit). Usually it looks somewhat strange because there is a header with a lot of settings for fonts, colors, paragraphs etc. But the body is quite understandable. In any case, it would take TextWrangler just a replace command (probably with regular expressions) to replace the given links with something that is working. Obviously, this is not really „live“. I’m not at my computer, but something like
set myFile to choose file set theSearch to "file://" set theReplace to "http://"
tell application "TextWrangler" replace theSearch using theReplace searching in myFile saving yes options {returning results:false} end tell
should do the job.
Cheers Thomas Am 18.04.2017 um 09:43 schrieb Jean-Christophe Helary < email@hidden>:
Is there an Applescripty way to modify the RTF contents of a TextEdit file (possibly "live")?
I'm mostly thinking of the half-baked link facility that TE offers (it would really link to local files unless you manually add "fille://" to the path you enter in the dialog etc...) which is *not* available in the dictionary...
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden