Hi,
First time scripter, been pulling my hair out on this. It’s a fairly simple action (I think). I’ve looked all over for answers, and searched this bb as best I could.
Heres the project: (needs to work for OS 9 and X - ok if requires separate script for each OS)
I want to:
- Copy a folder from a CD to the users ‘Documents’ folder
- Open a Word template in the copied folder
- ‘Save as …’ the Word template (Word takes card of where)
- Close the template window
- Open a Word document in the copied folder
Breaking down the actions (as I think Applescript needs)
Upon User double click of a compiled script on a CD named “Templates” the script will:
- Find out where a users ‘Documents’ folder is on their computer
- copy a folder “Mac Versions” from the CD into the users ‘Documents’ folder (for OS 9 OR OS X)
- open a ‘Template.dot’ that’s in the just copied “Mac Versions” folder (in their ‘Documents’ folder)
- ‘Save as …’ 'Template.dot (Word automatically saves it to the users ‘My Templates’ folder
- then open 'Document.doc that is in the just copied ‘Mac Versions’ folder
- End the script (with the Word document left open)
I have no ide how to deal with finding file path names so I can copy the folder to the right place and open docs from the copied location, so I’ve focused on the word docs. In testing so far (with a folder that’s on my Desktop in OS X)
I have created a script that does the ‘Open Template’ → ‘Save as…’ → ‘Open the word document’:
tell application “Microsoft Word”
open file “MY HD:Users:MY HOME:Desktop:Mac Versions:Templates:Template.dot”
do Visual Basic " ActiveDocument.SaveAs FileName:=“Template.dot”, FileFormat:=wdFormatTemplate"
close document 1 of window 1
open file “MY HD:Users:MY HOME:Desktop:Mac Versions:Document.doc”
end tell
Problem is, it only works if Word is already running. If it’s not, it get’s “broken” by the darned Project Gallery that opens on Word launch by default.
Thing is, normally, if a you double click on a Word file, Word will bypass the Project Gallery and open striaght to the file. THAT’s the behavior I want to implement.
So any help I can get on:
- Copying the folder from the CD to a users ‘Documents’ folder
- Opening the Template whether Word is running or not
will be greatly appreciated.
Thanks
Lyle