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: Tue, 20 Feb 2007 09:15:52 -0800
Hi Peter, thanks again.
These databases have been created from scratch in FM 8 but
constructed as close as possible to the original FM 6 solution they
replace.
I consolidated some of the tables that were previously in separate
files, cleaned up the relationship model, changed the security model
(there wasn't one before), and created a new interface. The
applescripts were simply the last of the legacy stuff that I had to
change.
It seems so far that none of the experts I have talked to on this
list or elsewhere have any idea why this problem I am having exists,
so I must chalk it up to a FileMaker bug or simple file corruption.
The files are live and get a lot of use however, so I will only stop
them on the server and check them for corruption as a last resort at
this stage. I still have a couple of leads I am trying to eliminate
as possible sources for the error first.
The fact that the "Get(LayoutName)" function fails to return anything
for any layout in any file I find the most disturbing. I have a
calculation field that calls that function and returns the result as
text. I don't see how that could fail.
Jeremy
Hi Jeremy,
Filemaker does have a system to automatically set up the layouts.
Unfortunately, if you want to have the import work properly, you
must import the scripts first, then the definitions and tables, and
finally the layouts themselves. If you do it in this order, your
layouts will always work properly and you won't lose links.
The get layout name problem is one I have also experienced and I
tend to use layout numbers (Get LayoutNumber)for my databases as
these continue to be reliable when you import work across from
earlier projects. I have particular problems when importing from
Filemaker 6 with the name recognition.
Are you just opening these databases in 8.5 and hoping that they
will work? A good place to start getting help on these issues is
at this site:
Upgrading to Filemaker 8.5 which discusses many of the issues you
are experiencing.
Basically, when I am updating an old database, depending on the
complexity of the database I use one of two methods. If the
database is small and simple, I open it in 8.5 and correct the
mistakes using the Database Design Report. Otherwise, I open a new
database and import the definitions, scripts and layouts as
mentioned earlier in this email. Large databases take too long
when hunting for errors through the report. If you take care with
the second method, it is very quick and is mostly error free.
Good luck,
Peter
On 17/02/2007, at 3:31 AM, Jeremy Bee wrote:
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
Peter Baxter
email@hidden
iChat email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to 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