hi, just about as amateur as it can get when it comes to applescript.
i was able to create a script that i used to call from a filemaker 7
database that took information from a record in the database, opened
word (version X), and basically inserted the information. all was
well until i upgraded to leopard, necessitating and upgrade to
filemaker 9 and word 2008. my old script used VBA and now im trying
to redo it using applescript.
ive been searching online, trying to piece things together but have
run into a snag that i cannot figure out.
so far i have....
tell application "FileMaker Pro"
tell layout "Create Estimate"
set mycontactaddress to cellValue of field "contact_address" of
current record
end tell
end tell
tell application "Finder"
open file "letterhead" of desktop
end tell
tell application "Microsoft Word"
activate
set myDoc to active do***ent
set myAddressTable to make new table at myDoc with properties
{number of rows:1, number of columns:2}
set enable borders of border options of myAddressTable to false
set content of text object of (get cell from table myAddressTable
of myDoc row 1 column 1) to "Cell 1, 1"
end tell
There are two problems.
1. if i run the script with Word initially closed, i get the error
"Microsoft Word got an error: Can=92t get active do***ent." on the 'set
myDoc to active do***ent' step.
if Word is active but there are no do***ents open, i get and error
"Microsoft Word got an error: Can=92t make class table." on the 'set
myAddressTable to make new table...' step.
if Word is active and "letterhead" is open, then it doesn't produce an
error on either of those steps.
is the script getting ahead of itself (thats what it seems like). can
i get it to pause between steps?
2. i get the error "Microsoft Word got an error: myAddressTable of
active do***ent doesn=92t understand the get cell from table message."
on the 'set content of text object...' step.
ive tried deleting that line and replacing it with "set myAddressCell
to cell 1 of row 1 of myAddressTable of myDoc" only to get the error
"Microsoft Word got an error: The object you are trying to access does
not exist" with 'cell 1' being the highlighted object that the error
refers to.
all i am trying to do at this point is insert text into the first cell
in the table i created.
any help is appreciated. thanks.


|