Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TextEdit find/replace script




On 16 Oct 2006, at 11:36, Bernard Azancot wrote:

Ihave written a very simple script performing the correction of OCR mistakes in a TextEdit RTF file.

Il use TextCommands osax.


Hi,

I think (or rather "guess", since my French is very bad) that the others have already mentioned that there is no 'change' command in either TextEdit or TextCommands. Not sure where you got that from!


This won't win any prizes, but should do the job...

tell application "TextEdit"
tell front document
set theText to text 1
set text 1 to my replaceTheText(theText, " cie ", " de ")
end tell
end tell

on replaceTheText(theText, theFromString, theToString)
tell application "TextCommands"
search theText for theFromString replacing with theToString
end tell
end replaceTheText


...bear in mind that it won't respect any text formatting though.

Hope that's of some help.

r.






---

Rob Stott
Production Workflow Developer

Watt Gilchrist Ltd
Albion Mills, Albion Road 
Bradford, BD10 9TQ 

Internal extension: 467



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

References: 
 >TextEdit find/replace script (From: Bernard Azancot <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.