Re: Scripting textedit the revenge
Re: Scripting textedit the revenge
- Subject: Re: Scripting textedit the revenge
- From: deivy petrescu <email@hidden>
- Date: Wed, 15 Jun 2005 14:52:07 -0400
On Jun 15, 2005, at 1:32, andrew wrote:
Thanks to has and others for your help with scripting textdit.
However it seems perhaps the problems was not my code but rather
something else
Here what happens :I have a large RTF textedit document ( about
95000) lines.
The script ( at end of this msg) runs and it starts off moving
very quickly about 2 lines per second...after 1500 or so lines the
speed is down to 1 line per second.
After about 3000 lines the speed is down to about 1 line per min
then expanding to 1 line per 2 min etc ...
Both versions of the script below produce the same result ...either
when running as an app or as a script...
The “Has” version takes longer to slow down but it eventually does....
This effect is very noticeable when running with the “event log”
tab open...but using a stopwatch reveals the problem exists even
running from the “application” state.
I have tried the experiment from a cold boot with no other
applications running and had similar results.
Anyone have any insights or perhaps provide conformation?
Thanks
Andrew
Scripts follow
--the Has version
tell application "TextEdit"
tell text of document 1
repeat with I from (count paragraphs) to 1 by -1
if color of paragraph I is not {0, 0, 0} then delete
paragraph I
end repeat
end tell
end tell
Andrew, not exactly a solution for your problem, however, if you want
to script something like an rtf document why don't you use Tex-Edit
Plus?
You should because it's good. It is probably the model for
scriptability, and, you could take care of your lines with a slimmer
and probably faster script:
<script>
tell application "Tex-Edit Plus"
tell document 1
delete (every paragraph whose color is not {0, 0, 0})
end tell
end tell
</script>
And, before Emmanuel jumps in; yes, you probably can do that in
Smile as well.
TE+ shareware $15 (worth every penny)
Smile free.
deivy petrescu
email@hidden
_______________________________________________
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