I have a filemaker database from which I merge data into word templates.
I am trying to add an additional variable to the applescript - the variable is the last variable set in the below script and is the last find and replace command.
All the other variables work fine and populate the template.
set thePath to cell "CDBloc" of current record as string
set Startdoc to thePath&"Templates:"
set Disc to cell "Template" of current record
set thetemplate to Startdoc & Disc
set theDate to cell "Date" of current record
set thefirm to cell "Firm" of current record
set thematter to cell "Matter" of current record
set theRef to cell "Ref" of current record
set docc to cell "Save_as" of current record
set act1 to repetition 1 of cell "Disc_Activity" of current record
set act2 to repetition 2 of cell "Disc_Activity" of current record
set act3 to repetition 3 of cell "Disc_Activity" of current record
set act4 to repetition 4 of cell "Disc_Activity" of current record
set act5 to repetition 5 of cell "Disc_Activity" of current record
set act6 to repetition 6 of cell "Disc_Activity" of current record
set act7 to repetition 7 of cell "Disc_Activity" of current record
set act8 to repetition 8 of cell "Disc_Activity" of current record
set act9 to repetition 9 of cell "Disc_Activity" of current record
set no1 to repetition 1 of cell "Disc_No_units" of current record
set no2 to repetition 2 of cell "Disc_No_units" of current record
set no3 to repetition 3 of cell "Disc_No_units" of current record
set no4 to repetition 4 of cell "Disc_No_units" of current record
set no5 to repetition 5 of cell "Disc_No_units" of current record
set no6 to repetition 6 of cell "Disc_No_units" of current record
set no7 to repetition 7 of cell "Disc_No_units" of current record
set no8 to repetition 8 of cell "Disc_No_units" of current record
set no9 to repetition 9 of cell "Disc_No_units" of current record
set un1 to repetition 1 of cell "Disc_Unit_Display" of current record
set un2 to repetition 2 of cell "Disc_Unit_Display" of current record
set un3 to repetition 3 of cell "Disc_Unit_Display" of current record
set un4 to repetition 4 of cell "Disc_Unit_Display" of current record
set un5 to repetition 5 of cell "Disc_Unit_Display" of current record
set un6 to repetition 6 of cell "Disc_Unit_Display" of current record
set un7 to repetition 7 of cell "Disc_Unit_Display" of current record
set un8 to repetition 8 of cell "Disc_Unit_Display" of current record
set un9 to repetition 9 of cell "Disc_Unit_Display" of current record
set ch1 to repetition 1 of cell "Disc_Charge" of current record
set ch2 to repetition 2 of cell "Disc_Charge" of current record
set ch3 to repetition 3 of cell "Disc_Charge" of current record
set ch4 to repetition 4 of cell "Disc_Charge" of current record
set ch5 to repetition 5 of cell "Disc_Charge" of current record
set ch6 to repetition 6 of cell "Disc_Charge" of current record
set ch7 to repetition 7 of cell "Disc_Charge" of current record
set ch8 to repetition 8 of cell "Disc_Charge" of current record
set ch9 to repetition 9 of cell "Disc_Charge" of current record
set tot to cell "Total estimate" of current record
set gst to cell "Estimate GST" of current record
set GT to cell "Grand Total Est" of current record
set Dly to cell "Daily_Rate" of current record
set Hly to cell "Hourly_Rate" of current record
set typ to cell "PIterm" of current record
tell application "Microsoft Word"
activate
open thetemplate
save as active document file name docc
end tell
tell application "Microsoft Word"
set findRange to find object of selection
tell findRange
execute find find text "<Date>" replace with thedate replace replace all
execute find find text "<Firm>" replace with thefirm replace replace all
execute find find text "<zf>" replace with theRef replace replace all
execute find find text "<Matter>" replace with thematter replace replace all
execute find find text "<A1" replace with act1 replace replace all
execute find find text "<A2" replace with act2 replace replace all
execute find find text "<A3" replace with act3 replace replace all
execute find find text "<A4" replace with act4 replace replace all
execute find find text "<A5" replace with act5 replace replace all
execute find find text "<A6" replace with act6 replace replace all
execute find find text "<A7" replace with act7 replace replace all
execute find find text "<A8" replace with act8 replace replace all
execute find find text "<A9" replace with act9 replace replace all
execute find find text "<U1" replace with no1 replace replace all
execute find find text "<U2" replace with no2 replace replace all
execute find find text "<U3" replace with no3 replace replace all
execute find find text "<U4" replace with no4 replace replace all
execute find find text "<U5" replace with no5 replace replace all
execute find find text "<U6" replace with no6 replace replace all
execute find find text "<U7" replace with no7 replace replace all
execute find find text "<U8" replace with no8 replace replace all
execute find find text "<U9" replace with no9 replace replace all
execute find find text "<N1" replace with un1 replace replace all
execute find find text "<N2" replace with un2 replace replace all
execute find find text "<N3" replace with un3 replace replace all
execute find find text "<N4" replace with un4 replace replace all
execute find find text "<N5" replace with un5 replace replace all
execute find find text "<N6" replace with un6 replace replace all
execute find find text "<N7" replace with un7 replace replace all
execute find find text "<N8" replace with un8 replace replace all
execute find find text "<N9" replace with un9 replace replace all
execute find find text "<C1" replace with ch1 replace replace all
execute find find text "<C2" replace with ch2 replace replace all
execute find find text "<C3" replace with ch3 replace replace all
execute find find text "<C4" replace with ch4 replace replace all
execute find find text "<C5" replace with ch5 replace replace all
execute find find text "<C6" replace with ch6 replace replace all
execute find find text "<C7" replace with ch7 replace replace all
execute find find text "<C8" replace with ch8 replace replace all
execute find find text "<C9" replace with ch9 replace replace all
execute find find text "<tot" replace with tot replace replace all
execute find find text "<gst" replace with gst replace replace all
execute find find text "<GT" replace with GT replace replace all
execute find find text "<d>" replace with Dly replace replace all
execute find find text "<h>" replace with Hly replace replace all
execute find find text "pers" replace with typ replace replace all
end tell
end tell
The error I get in filemaker is “Microsoft Word got an error: find id «data iWioB0620D81» of selection doesn’t understand the “execute find” message.” followed by a new dialog “Unknown error: -1708”
I cannot see what the issue is - can anyone else?
All and any input gratefully received as I am an amateur at this.
After a little further investigation the data iWioB0620D81 seems to vary each time i execute the script.