Applescript, unicode text and word x

G

G.Miller

Help please!

I have a mac running Word X SR1 and OS10.3.6

I created an applescript that copies data from a filemaker pro 6 database to
a variable and inserts it into a word document. Works great.

Then I upgraded to filemaker pro 7 and suddenly word does not like it
anymore. An example of each script is below:

FMpro6:
Tell application "Filemaker Pro 6"
Set myData to cell "field_name" of current record of database
"database.fp5"
End tell
Tell application "Microsoft Word"
Activate
Set contents of selection to myData
End tell

FMpro7:
Tell application "Filemaker Pro 7"
tell layout "layout_name"
Set myData to cell "field_name" of current record
End tell
End tell
Tell application "Microsoft Word"
Activate
Set contents of selection to myData
End tell

When I run the FMpro6 script, the class of myData is 'string'
When I run the FMpro7 script, the class of myData is 'Unicode Text'

Does microsoft word not accept Unicode Text?

I have tried to change the class by adding:
Set myData2 to myData as string

But I still get the error when I try to insert the data in word.

The error I get is
"Microsoft Word cannot set contents of selection to "whatever text is in the
field"

If anyone has any insight, I would much appreciate it.

Thanks,

G.Miller
 
E

Elliott Roper

G.Miller said:
Help please!

I have a mac running Word X SR1 and OS10.3.6

I created an applescript that copies data from a filemaker pro 6 database to
a variable and inserts it into a word document. Works great.

Then I upgraded to filemaker pro 7 and suddenly word does not like it
anymore. An example of each script is below:
Does microsoft word not accept Unicode Text?

Word X does not do Unicode, Word 2004 does
I have tried to change the class by adding:
Set myData2 to myData as string
if string is an 8-bit character array and Applescript does the
translation, you would think that was ok.
But I still get the error when I try to insert the data in word.

The error I get is
"Microsoft Word cannot set contents of selection to "whatever text is in the
field"

If anyone has any insight, I would much appreciate it.
See whether you can debug it with the 2004 tryout.
or see if the unicode to 8-bit translate is working like you think it
should.
(mostly guessing I am. Not too hot on Applescript yet)
 
G

G.Miller

Elliot,

Thanks for your help. I found the answer I was looking for.
FYI to import unicode text into word x from applescript I found that the
following works.


Set aVariable to whatever (unicode text)

tell application "Finder"
set aVariable to item 1 of ((aVariable as record) as list)
end tell

tell application "Microsoft Word"
set contents of selection to aVariable
end tell

Thanks,

geoff
 

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