Re: Set Contents not working
Re: Set Contents not working
- Subject: Re: Set Contents not working
- From: kai <email@hidden>
- Date: Tue, 15 Nov 2005 01:22:20 +0000
On 15 Nov 2005, at 00:13, Ted wrote:
Thanks a million, Kai. That fixed the problem. However, there's
one last thing that doesn't work properly. Here's the code:
tell application "TextEdit"
make new document
set the text of front document to "Database report on " & dName &
return & return
set the font of the last paragraph of front document to "Courier"
set the size of the last paragraph of front document to "12"
...
end tell
The lines that begin with "set the font..." and "set the size..."
don't appear to do anything. The entire text is only a single font
of a single size. Again, I've studied the dictionary, but I don't
see what could be wrong. Any ideas?
It works OK here, Ted - but there's a bit of a glitch if I try typing
new text directly in the last paragraph. The style isn't picked up,
even though it does actually change. Depending on what you're trying
to do, there'll probably be a workaround for this. But hopefully, the
following will demonstrate that the style of the last paragraph
changes when it contains text:
----------------
tell application "TextEdit" to tell (make new document)
set its text to "Database report on " & dName & ¬
return & return & "This is the last paragraph..."
tell last paragraph
set font to "Courier"
set size to "12"
end tell
end tell
----------------
And here's one way to retain the style in an empty last paragraph,
ready for typing, etc.
----------------
tell application "TextEdit" to tell (make new document)
set its text to "Database report on " & dName & return & return
tell last paragraph
set font to "Courier"
set size to "12"
end tell
end tell
tell application "System Events" to tell process "TextEdit"
set frontmost to true
key code 123
key code 124
end tell
----------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden