I’m looking for a way to Open a document in word, save the document as a text file in the same place but with the same name with different extension.
Here is what I got so far:
set myWordFile to choose file with prompt "Choose a word document"
tell application "Microsoft Word"
activate
open myWordFile
save window 1
end tell
I know the save window is not complete, that’s where I’m stuck. If I record word while doing this, it just makes some VB script and incorporates it in AS. I’m sure there is a way to do this in AS without going into VB.
set myWordFile to choose file with prompt "Choose a word document"
tell application "Microsoft Word"
activate
open myWordFile
set myWordFileName to myWordFile as string
set saveFile to """ & myWordFileName & ".txt""
do Visual Basic "ActiveDocument.SaveAs FileName:=" & saveFile & ", FileFormat:=wdFormatText, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False, HTMLDisplayOnlyOutput:=False"
close window 1 saving no
end tell
Someone who knows more than I about it could probably tell you how to just use Word’s AS save command instead of that VB stuff, but I don’t know the class type for a text document.
save: Save an object
save reference -- the object to save
[in alias] -- the file in which to save the object
[as type class] -- the file type of the document in which to save the data