Script doesn't work from FMP related file

The script below is used within a FileMaker script and it works fine. But, when I try to activate it from a related FileMaker file, I get the following error message:
“FileMaker Pro got an error: Object not found. (Error -10006)”
Has anybody run into this problem?

– in FileMaker (gtextHolder is a FileMaker global field)
set gtextHolder1 to “gtextHolder1”

–over to Word to grab the data
tell application “Microsoft Word”
copy (section 1) to theText
end tell

–Back tp FileMaker to set the text into the global field, gtextHolder

tell application “FileMaker Pro”
set field gtextHolder1 to theText
end tell[/i]

If the field you are trying to set is a related field you have to refer to the field as such.
Put your FMPro Database into layout mode and check out how the field name is represented. If the actual field name is gtextHolder1 then the related field would be
“::gtextHolder1” (note the two colons). When you refer to that field in your script you need to do two things.

  1. address the actual database you are working with
    –set myDB to a reference to database “some db name.fp5”

  2. when you set the related field, define which DB you are addressing, and be a little more specific on the field name. Let’s say your related DB name is “foo.fp5”
    –set field “foo::gtextHolder1” of myDB to theText

full example

tell application "FileMaker Pro" 
--activate--FYI this makes FMPro slower and in my experience is not needed unless running a script.
set myDB to a reference to database "some db name.fp5"
set field "foo::gtextHolder1" of myDB to theText 
end tell

I found this out by setting up a calculation field to get the field names of a layout. My related field referred to the related DB, but for some reason drops off the .fp5.

Good luck!


Thanks for your input. Actually, it didn’t work. The thing is that the AppleScript in question is part of a script in the related FMP file. I tried your idea, then I tried rewriting it so that it would work from the primary file using your idea. No go. I am dying of eyestrain and I am going to bed.

It’s not very important. I have to learn applescript for a job and I decided that, as an exercise, I would try translating an exported Netscape Address Book from an .ldif file into a FMP database and then back. The whole design is haphazard and stupid. There are about six things I could do to work around the problem. But it is the solutions to the problems that I need, not this silly little translation program!

What I really need is a couple of books that deal with AppleScript as it relates to other applications. I delighted to find, for instance that you could record a series of actions in Word, only to discover that what was really being recorded was not AppleScript but Word macros which I guess are in Basic – and they often don’t work when you play them back.

Anyhow, thanks for the tip. Even though it didn’t work, I learned something and that is the point at the moment.

Jake Sterling


I know it’s just an exercise but I need closure. I understand if you are too busy to respond.

Here is what I based my post on.

I have 2 FMPro databases. Database 1 had 2 fields, and database 2 had 2 fields only the second field was a related field from database 1, based on a relationship between field 1 of both databases. My script, run from within database 2, set the data within field 2 of the database 2 which by relationship actually changed field 2 from database 1. Gosh, now that I look at that it is confusing.

Maybe I misunderstood what you were asking.

Good luck in your new job.


Do you get jitters if more than an hour goes by without seeing AppleScript code? Do you find yourself waking from a sound sleep just so you can squash the last bug in a script? Do you require prescription drugs to overcome the anxiety caused when someone doesn’t let you know if your AppleScript code worked? Does your alarm clock consist of iTunes driven by AppleScript? Do you think in terms of AppleScript when dealing with issues unrelated to technology (if “child” is “bad” then set playtime to (playtime - (1 * hours))?

If you answered yes to two or more of these questions, you should consider membership in ASSA (AppleScript Scripters Anonymous). Monthly meetings are held from 1 am - 6 am on the first Scriptday of each month (Note: In months with more than 14 days, an additional meeting will be held on the third Scriptday of the month). To keep things interesting, and to help improve social skills, each ASS will be required to host meetings on a rotating schedule. Membership is free and all scripts that might be created during these meetings shall become open sores… er… source.