• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Scripting textedit the revenge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting textedit the revenge


  • Subject: Scripting textedit the revenge
  • From: andrew <email@hidden>
  • Date: Wed, 15 Jun 2005 01:32:46 -0400

Title: Scripting textedit the revenge
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


--- the original version
tell
application "TextEdit"
    
activate
   set y to 1
   set x to the count of paragraphs of the first document
   repeat until y = x
       set test_var to properties of paragraph y of document 1
       if the color of test_var ≠ {0, 0, 0} then
           
delete paragraph y of document 1
           --display dialog " delete #" & y
           set y to y + 1
       else
           --
display dialog " NOOO delete #" & y
           set y to y + 1
       end if
   end repeat
end
tell

 _______________________________________________
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

  • Follow-Ups:
    • Re: Scripting textedit the revenge
      • From: deivy petrescu <email@hidden>
  • Prev by Date: Re: Applescript for 7 year Installation!
  • Next by Date: Re: crop left half of image via script / iMagine Photo
  • Previous by thread: Re: create a DVD with applescript/automator
  • Next by thread: Re: Scripting textedit the revenge
  • Index(es):
    • Date
    • Thread