Hi,
I’m trying to create a script that builds an RTF document pre-loaded with some basic information. I don’t want to use templates for this because I have rules about where the new document is to be created based on various attributes that I capture during the creation process.
However, I’m at a loss to figure out how to create a basic RTF document. I’ve never worked with these before, and I can’t seem to find a good, basic example of how this is done.
It looks like I want to create a new record like this:
create record with {name:"foobar", type:rtf, rich text:someText} in myGroup
where “myGroup” varies depending on the date, time of day, type of information, etc.
But how do I define the rich text? I’ve tried things like:
make new text
but DevonThink reports:
So I thought that I needed to make the record and then set content to it, so I tried this:
set newRec to create record with {name:"foobar", type:rtf} in myGroup
but applescript reports “missing value”
I did also try to load the contents of an existing RTF document into the new record using the source attribute:
set newRec to create record with {name:"foobar", type:rtf,source:"/path/to/myFile.rtf"} in myGroup
But what I get in that case is an RTF record with the line “/path/to/myFile.rtf”. Is there some way to open the document, retrieve it’s RTF content, and use that when I create the new record so that I can (hopefully) modify the template source from the script?
Anyway, I’ve tried about a hundred variations and permutations here, playing around with paragraphs and words and so forth, guessing at the correct way, but all I’m doing is spinning my wheels.
Can anyone help? A basic example of creating an RTF document from a script would be really nice.