FM 8 layout references w/applescript - works in one file, fails in five other identical files!
FM 8 layout references w/applescript - works in one file, fails in five other identical files!
- Subject: FM 8 layout references w/applescript - works in one file, fails in five other identical files!
- From: Jeremy Bee <email@hidden>
- Date: Tue, 13 Feb 2007 14:43:59 -0800
Hi,
I have some FM 6.0 files that I am converting to FM 8.0 and what
initially seemed like easy changes to an internal applescript have
steadfastly refused to work in the new files. I can find almost *no*
online resources for Applescript that are more recent than five years
or so ago except this list so here goes....
The big mystery here (at least to me), is that there are six
essentially *identical* FM files each with this same script. Yet the
script works in one file (as well as in my test files), and
completely fails in the other five files. The files have different
file names, and one or two of the fields have slightly different
names, but the appropriate name changes have been made in the
applescript.
In the old FM 6 files the script started like this:
tell application "Filemaker Pro"
set stno to cell "AssignedTemp::AssignStudentNumber" of current record
In the new FM 8 files the script begins like so:
tell application "FileMaker Pro"
tell document "206 Students 06-3"
tell current layout
tell current record
set AS_stNum1 to field "AssignedTemp::AssignStudentNumber"
end tell
end tell
end tell
end tell
This is obviously not rocket science. What is going wrong here and
what I can find almost no information on, is the correct form for
addressing fields and layouts with Applescript in FM8. The script is
a lot longer, but I can tell by putting in "say's" that it never
makes it through this first block.
The really mystifying thing is that this part (and the entire script)
actually WORKS JUST FINE in the file referenced above, but when I put
it in any of the other files (say... "204 Students 06-3"), and change
the file reference in the Applescript to match, it fails completely
on this first block. ARGGHHH!!!
The failure is that ever-handy "object not found" message which I
take to mean the script cannot find an application, file, layout,
field or record of that name. I can rewrite the script to address
the tables instead of the field/layout route, but that gives a
different result and also works fine in the one file and not in the
others.
I have tried specifying the layout by name (instead of as "current
layout"), and changing the naming of the files and fields so as to
head off possible illegal characters and also adding or not adding
the file extension on the file reference. It all works like a charm
in the one file and not at all in the other five almost identical files.
The only clue I have is that if I create a calculation field that
uses the "Get(Layout Name)" function in FileMaker, it gives a "?" as
a result no matter what layout of what file I put it on.
Jeremy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden