I found this thread and several others in this forum, looking for a way to create a word 2004 doc with some text created in another program. Let me start by saying that I know very little about Applescript.
I tried various ways, including the quoted one. All of them generate compiling errors in Scripteditor.
For instance,
“insert text the_text at end of text object of newDoc” generates “expected line end, but got identifier” (with “the_text” highlighted)
When I comment that one out, the next line
save as newDoc file name (desk_path & “Sample.doc”) generates “expected line end, but got class name” (with “file” highlighted).
I can’t imagine the script to be in error, so there must be something I am doing wrong. But I have not got a clue where to start looking.
I appreciate any tips and help. And I promise to keep digging in this forum.
Maarten
(OS: 10.5.4, intel based, Word 2004)
Model: Macbook Pro
AppleScript: 2.0.1
Browser: Firefox 3.0.1
Operating System: Mac OS X (10.5)
Sorry, I don’t use v.X any more.
Probably the most reliable way is to do it in Visual Basic, because this works also in v.X
The code to make an new document and insert text is
Set NewDoc = Documents.Add
With NewDoc.Content
.Text = "Hello World"
End With
the AppleScript code is
do Visual Basic ". ."
Maybe the save command from Standard Suite works in Word v.X
I was hoping to avoid vBasic. Anyway I now realise I am going to have to make provisions for three versions of word (vX, 2004 and 2008) for this to work in my company. I guess I am first going to see if I can get my employer to upgrade (or switch to Pages) to make my life easier.
Thanks again for triggering this thought process. If you ever need help with Filemaker, go to http://filemakertoday.com/com/index.php and I hope I can repay the service