Re: FM 8 layout references w/applescript - works in one file, fails in five other identical files!
Re: FM 8 layout references w/applescript - works in one file, fails in five other identical files!
- Subject: Re: FM 8 layout references w/applescript - works in one file, fails in five other identical files!
- From: Jeremy Bee <email@hidden>
- Date: Fri, 16 Feb 2007 08:31:17 -0800
Thanks again Peter,
I realise it's hard to diagnose complex issues on a list like this
anyway which is why I tried to make each post concerned with a
specific question. My last response was trying to get at whether
there is some method (beyond the obvious ones that I am aware of),
that the system uses to link a script to a layout and it appears from
your response that there is not.
I guess I am leaning more towards simple file corruption now in that
the buttons are certainly there and certainly have the scripts
attached, yet the database report says they are "not used" on the
layout on which they so clearly sit, attached to those same buttons.
I still also have to solve the problem of why a simple calculation
field that uses Get(LayoutName) returns only a question mark on any
of my layouts. I appreciate the help anyway and despite sounding
like a noob I have actually been doing this kind of development for
years and this is the first time I have run across such an
intractable problem.
I have a feeling this is going to be a long convoluted affair. :-)
Jeremy
Hi Jeremy,
It's a bit hard to do this without looking at the file, but I
suspect that your buttons on the faulty layouts have just lost
their connection to the relevant script. I sometimes do this if I
make a new file by copying layouts from other files and do the task
in the wrong order. i.e. If I import the Layout before I import
the scripts, the buttons will not be linked to the script. All you
have to do is reconnect the buttons to the relevant scripts manually.
Peter
On 16/02/2007, at 10:24 AM, Jeremy Bee wrote:
Hi Peter, thanks for your reply.
I think you may have identified the problem, but I still can't see
it very clearly, and/or how to fix it. I *do* have the Developer
version and when I do a Database report there *is* a difference
that shows up between these otherwise identical files.
In the report, under "Layouts that use this script," the file that
works lists the name of the layout on which the script is used/
activated (the layout with the button that activates the script).
On the other, otherwise identical files, it lists nothing at all.
i.e. - as far as those files are concerned, no layouts use that
script. This would probably create the "object not found" error
in the first block of the script when it refers to the "current
layout."
What I can't see is why this would be the case.
The layouts seem identical to me, they have the same name, they
have buttons that activate the script in question etc. The button
is in a portal on the layout, but the portal, the fields it
contains and the relationship it uses are all similarly
identical. I have very carefully checked the syntax and the exact
names of layouts and scripts etc. so as to eliminate the case of a
simple typographical error.
How do I repair this? What I need to know is what the essential
difference is between a layout that "uses this script" and one
that doesn't (given that they are seemingly identical layouts),
and how does FileMaker report or keep track of that?
Jeremy
The first thing I would check is whether your relationships
between layouts are correct. Your problem with the calculation
field suggests that you may have lost the relationship. Do you
have Filemaker, or Developer version? If you have a developer
version, you can check for lost relationships.
Peter
On 14/02/2007, at 9:43 AM, Jeremy Bee wrote:
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 (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-
users
This email sent to email@hidden
Peter Baxter
email@hidden
iChat email@hidden
Peter Baxter
email@hidden
iChat email@hidden
_______________________________________________
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