Re: 3 random typefaces intermixed
Re: 3 random typefaces intermixed
- Subject: Re: 3 random typefaces intermixed
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 27 Mar 2008 18:29:36 -0400
Well, this works:
set fontList to ["TimesNewRomanPSMT", "Tahoma", "LucidaHandwriting-Italic"]
set text item delimiters to ""
tell application "TextEdit"
set c to get count of characters of text of document 1
repeat with i from 1 to c
set fontIndex to random number from 1 to 3
set fontChoice to item fontIndex of fontList
set font of character i of text of document 1 to fontChoice
end repeat
end tell
But it is, as Doug said, dog slow. In fact, just
repeat with i from 1 to c
-- do nothing
end repeat
takes forever inside a TextEdit tell block. Looping outside TextEdit
is fast, but adding the tell inside the loop brings the slowness right
back.
TextEdit supports the idea of "attribute runs"; I can imagine that if
instead of setting the font on each individual character, you first
decided (randomly) how many in a row to set and did them all in one
go, it might help a little, but I couldn't figure out how to make a
new attribute run of a certain size out of existing text.
_______________________________________________
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