hi, im stuck trying to create a script that adds data to a word
do***ent. im trying to figure out how to add spaces (ie similar to
typing the return key) between things i insert into a doc as follows:
-open do***ent
-advance the cursor down below the logo that is already there
-type return
-insert the date as text (not as field)
-type return
-add table, format and populate
-advance cursor down below the table
-type return
-insert text from a variable
everything works great except i end up with: the logo, 2 spaces, the
date, the table, 1 space, text
what im looking for is: the logo, 1 space, the date, 1 space, the
table, 1 space, text
if i substitute 'type text selection text "the date"' for the 'insert
date time' step, the spacing is correct, but obviously it just says
"the date". what am i missing? ive read through the word 2004
applescript guide to no avail.
-----script
tell application "Microsoft Word"
open alias ((path to desktop as text) & "letterhead")
set myDoc to active do***ent
-- advance cursor down
navigate text object of selection to goto a line item position
relative count 2
--add space
type paragraph selection
-- insert date, not as field
insert date time at text object of selection date time format "MMMM
dd, yyyy" without insert as field
--add space
type paragraph selection
-- add table, format and populate
set myAddressTable to make new table at myDoc with properties {number
of rows:1, number of columns:2}
set enable borders of myAddressTable's border options to false
-- add contact info and contact numbers to table
set content of text object of (get cell from table myAddressTable row
1 column 1) to mycontactaddress
set content of text object of (get cell from table myAddressTable row
1 column 2) to mycontactnumbers
-- align the contact numbers right
set alignment of paragraph format of text object of (get cell from
table myAddressTable row 1 column 2) to align paragraph right
navigate text object of selection to goto a line item position
relative count 2
-- advance cursor down
type paragraph selection
--insert text from variable
set content of text object of selection to myestimatebody
end tell


|