Re: Sending many lines of text to TextEdit window
Re: Sending many lines of text to TextEdit window
- Subject: Re: Sending many lines of text to TextEdit window
- From: Philip Aker <email@hidden>
- Date: Mon, 14 Sep 2009 08:29:43 -0700
On 2009-09-14, at 07:49:08, Jan E. Schotsman wrote: I would like to quickly log lots of lines to a TextEdit window.
One problem I noted I have to set the font each time. For example:
tell application "TextEdit" activate make new document at the beginning of documents set the name of window 1 to "Test window" set the text of the front document to ¬ "The quick brown fox jumped over the lazy dog." tell the text of the front document set the font to "Courier" set the size to 11 end tell (*set curText to text of the front document set curText to curText & "Then it sped away." set the text of the front document to curText*) end tell
If the last part is uncommented the font reverts to the default font. Also this is very slow in case of many lines (calling this script once per line).
How can I speed this up other than by concatenating lines, setting the font once per second only, etc?
I think you should pump in all the text first and then set the font characteristics. This works on my 10.6.1 setup:
tell application "TextEdit" tell document 1 set its text to "If the last part is uncommented the font reverts to the default font.\nAlso this is very slow in case of many lines (calling this script once per line).\n\nHow can I speed this up other than by concatenating lines, setting the font once per second only, etc?\n" end tell tell document 1 set colr to {16384, 0, 32768} set its color to colr set font to "Courier" set size to 11.0 end tell end tell
Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
|
_______________________________________________
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