Word 2008- Save and name with applescript

E

elpada

Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I have a .dot template file that I use daily. I don't have a problem with the rest of the script but i'd like to replace two dialog boxes with text that i've already entered in fields DName and DOB, but for the life of me cannot figure out how to reference or pull the text out of these two text fields in a word 2008 document. Essentially the first two text form fields in the document contain the name and date of birth and i want to turn that into the file name.

i.e. what i've got now
tell application "Microsoft Word"
        set DName to text returned of (display dialog "What is the name?" default answer " ")
        set DOB to text returned of (display dialog "What is DOB?" default answer " ")
        set NameDob to DName & "." & DOB
        log NameDob
        save as active document file name NameDob
end tell

and what i'd like...
tell application "Microsoft Word"
        set DName to value of field dname
        set DOB to value of field DOB
        set NameDob to DName & "." & DOB
        log NameDob
        save as active document file name NameDob
end tell

I've tried lots of variations of the above but can't figure this out. Any thoughts.
 
P

Peter Jamieson

try

tell application "Microsoft Word"
set DName to form field result of form field "dName" of active document
set DOB to form field result of form field "DOB" of active document
set NameDob to DName & "." & DOB
log NameDob
save as active document file name NameDob
end tell

Peter Jamieson

http://tips.pjmsn.me.uk
 
E

elpada

thanks i'll try that. I couldn't get the syntax correct and the dictionary wasn't much help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top