Re: How do I append text at the end of a textedit document?
Re: How do I append text at the end of a textedit document?
- Subject: Re: How do I append text at the end of a textedit document?
- From: "Nigel Garvey" <email@hidden>
- Date: Fri, 11 May 2007 12:44:59 +0100
Michelle Steiner wrote on Thu, 10 May 2007 12:35:36 -0700:
>On May 10, 2007, at 12:18 PM, mac script wrote:
>
>> I have created a "textedit" document (make new document at the
>> beginning of
>> documents with properties {text: "blah.. blah"}). I haven't saved
>> or closed
>> this.
>>
>> Immeditely after this I want to append another text say
>> (text:"woh ... woh")
>> at the end of the document I created above.
>>
>> How will I do this?
>
>tell application "TextEdit"
> set newDoc to make new document with properties {text:"blah.. blah"}
> tell newDoc
> set its text to its text & " more text"
> end tell
>end tell
Alternatively:
tell application "TextEdit"
set newDoc to make new document with properties {text:"blah.. blah"}
make new word at end of text of newDoc with data " more text"
end tell
Instead of making a new 'word', you could specify a new 'character' or a
new 'paragraph'. It doesn't make any difference. It's the data that
count. If you actually want a new paragraph, the data must include the
necessary line endings.
('text of' appears to be optional too.)
NG
_______________________________________________
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