• 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
Faster way to replace text in AppleWorks?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Faster way to replace text in AppleWorks?


  • Subject: Faster way to replace text in AppleWorks?
  • From: Dale Gillard <email@hidden>
  • Date: Sun, 29 Sep 2002 21:40:52 +1000

Hi all

I have written a script that loops thru an AppleWorks document looking for specific characters and replacing them eg ensuring a period/full stop has a single space after it. As you can imagine, it takes quite a while to do this even in a document of only a few hundred words.

Does anyone have any advice on how I could speed this up this process? eg a 'you beaut' algorithm that's really fast at doing this rather than my 'naive' algorithm.

Here's a snippet of the script so you can get an idea of what I'm doing:
------------------------------------------------------------------------ -
set space to " "
set CharCount to count of characters of front document
-- Start backwards to avoid loop variable being changed when a char is added or removed.
repeat with aCharacter from CharCount to 1 by -1
-- If a comma or period is found
if character aCharacter of front document is comma or character aCharacter of front document is period then
-- If 1 space does not follow it, add a space.
if character (aCharacter + 1) of front document is not space then
make new character at character aCharacter of front document with data space
end if
end if
end repeat
------------------------------------------------------------------------ -

Many thanks
Dale Gillard
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Faster way to replace text in AppleWorks?
      • From: Jay Young <email@hidden>
    • Re: Faster way to replace text in AppleWorks?
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Adobe's lousy AppleScript implementations
  • Next by Date: Re: How to do an HTTP POST?
  • Previous by thread: Re: Change password
  • Next by thread: Re: Faster way to replace text in AppleWorks?
  • Index(es):
    • Date
    • Thread