Save as dialog / get word 1

I have thousands of text documents that I am importing into Appleworks 6, and for witch, I want to save as the first word of the text body. But I’m not proficient enough with applescript to accomplish this. So if someone would help me with the syntax I would appreciate it.

what im trying to accomplish is this:

Having many windows open in appleworks I want to save each one as text with the name as the first word [all unique and on the 1st line by itself] of the text body, and then close each window after saving.

the importing I have automated using Script-Editor 2.1 but am stuck with automating the ‘close and save as’ end of things.
Files are imported as .rtf and want to change to .txt w/o the extension.

Where they get saved is not an issue, I just don’t want to get stuck changing “untitled 147” to “Abel-beth-mizraham” and the like!

Thanks for helping your noob:

Pls post your code and point out where you’re having trouble.


Here’s an example for saving 1 rtf document as text.

set rtf_file to choose file
set desktop_path to (path to desktop) as string
tell application “AppleWorks 6”
open rtf_file as document type text document
set p to paragraph 1 of front document
set file_spec to (desktop_path & p & “.txt”) as file specification
save front document in file_spec using translator “Text”
close front document saving no
end tell

You add error checking to whatever level you want. Using the file specifcation, you don’t need to use the save dialogs. Oviously you write the script according to your own preferences.