TextEdit's 'Find' and 'Replace' with AppleScript


I’m new to MacScripter and also to AppleScript.

I wonder if it’s possible to run with AppleScript TextEdit and to use Find (command + F) command and then to locate a specific word and replace it with another? I can go to as far as opening a file with TextEdit. And I don’t know what to do next. I suppose you can’t find Find command.

If we can’t use Find, could somebody tell me any other way to do this task, please?

Thank you.

tell application “Finder” to set the source_folder to (folder of the front window) as alias
on error – no open folder windows
set the source_folder to path to desktop folder as alias
end try

tell application “Finder”
select Finder window 1
open document file “faq_body.tpl” of folder “x213” of disk “RamDisk”
end tell


Check this posting out:


Once you are logged in, feel free to use the [search] function highlighted near the center of the top menu bar. You can search all the forums and often find exactly what you are looking for quickly and easily.

Also, when you have some code to post, copy it from your editor (I usually do ⌘-A and then ⌘-C) and when you are in the posting section here, click on the url or http button, place your cursor between the bracketed items, and ⌘-V. That way, anyone that wants to examine your code can upload it into their editor with a single click.

Keep the questions coming.

Oh, wow! Thank you.