MACSCRPT Archives

July 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Macintosh Scripting Systems <[log in to unmask]>
Mime-version:
1.0
Date:
Wed, 12 Jul 2006 01:25:12 -0400
Reply-To:
Macintosh Scripting Systems <[log in to unmask]>
Content-type:
text/plain; charset="US-ASCII"
Subject:
From:
"Gary (Lists)" <[log in to unmask]>
In-Reply-To:
Content-transfer-encoding:
7bit
Parts/Attachments:
text/plain (125 lines)
"Joe Barwell" wrote:

> Hello People,
> 
> I have a question about applescript & FileMaker Pro 6. I want to script
> a part of FMP that is not ordinarily scriptable--i.e. there are no
> commands for it in FMP's dictionary. I want to script the Export
> Records function, using GUI Scripting, via macos x's System Events.

As Mark wrote (and showed), build your FM script to do this, and then just
activate that script.

You replied to that suggestion:

> Hello Mark,
> 
> What I find is that FMP will not even activate, once one of the
> relevant dialogs are open (either the "Export Records" or "Specify
> Fields" dialogs). That prevents me from manually setting up one of
> those two dialog windows in advance, in order to do scripting
> experiments

I don't understand this dilemma.  How could the script prevent you from
doing any set-up beforehand?  You shouldn't be running the script yet.  You
need to do your export manually, once, then make your FM script and the
primary portions of your export can be saved.

Perhaps I wasn't able to read between the lines enough to know just what you
mean here, particularly with "That prevents me from manually setting up one
of those two dialog windows in advance".

> Unfortunately, it does not seem to work. Whenever I run the following
> script, Smile seems to go into a loop, or else is perhaps "locked'--my
> suspicion is that it is waiting for a return appleevent from the
> 'keystroke' command.

[and]

> If I dismiss the "Export Records to File" dialog inside FMP, I then get
> a dialog from FMP saying "Before typing, press Tab, click in a field,
> or choose the New Record menu command."

Okay, this is a dialog which indicates either one of two things:

    You have no records in your database, yet.
    You have no Find requests, if in Find mode.

Do your export manually, no AppleScript, and complete the process.  Then,
make a FM script with those portions of that process which can be saved,
will be able to be included in your script.

> Smile then "unlocks"/loses its
> spinning pinwheel cursor. This makes me wonder if this is a legacy
> issue--i.e. a modal dialog from FMP6 that predates macos x?

FileMaker does not, and has never, conformed to the basic Mac UI structure.
Even in OS 9, UI scripting FileMaker with KeyQuencer worked when practically
no other tool would.

But, KeyQuencer did a fairly good job of getting at UI elements.

The current (X) versions of FM exhibit the same non-standard UI structure.

> My question, then, is this: has anyone else had any luck in GUI
> Scripting the non-scriptable parts of FMP6?

Since you are using an older FileMaker, you can run this in Classic.  And,
under Classic, you __can__ use KeyQuencer to automate your process. [1]

I wrote (and still have) a whole set of AppleScript handlers that performed
KeyQuencer tasks, to work with FileMaker -- specifically, auto-creation of
fields and auto-creation of blank named layouts.

The same tool could be used to do much more with FM 6 than I think you will
be able to do with UI Scripting under X.  But there may be other
UI-manipulation tools, like KQ, which might.  I don't know, as I have given
up on most UI scripting, since the benefits seem to significantly pale to
the needed time to write a useful script...this is especially true, I think,
for applications like FileMaker which fly their own flag when it comes to
their hodge-podge of UI element structure.


I really would consider more closely the kind of process which Mark
outlined, since FileMaker does have rather good internal workflow controls.
Even if they, alone, will not get you through the entire process, they may
be able to get you most of the way.  And, where UI scripting can work,
perhaps the combination will do the job.

Of course, upgrading to FM 7 will get you even further, since there are
whole new classes of internal functions to handle auto-export (you can
variably name output files and such.)

Alternatively, if upgrading (FM is at version 8, now ;) [2] is not an option
for financial reasons, then perhaps a lower-cost alternative is to explore a
FileMaker 6 Plug-In, like the Troi series, where there are some tools to
automate other processes.  Given the age of FM6, I would think that FM 6
version plug-ins could be gotten for very little (less then $50, as a
guess).

--
Gary


[1] I am happy to share my KQasFM (that was my clever name,
KeyQuencer/AppleScript/FileMaker, and pun :-/ ) handlers with you, as well
as the free version of KeyQuencer Lite for OS 9.  It's a real breeze to use,
and I love the program. I wish there were an X version.  It was, IMO, the
best "macro utility" for Mac OS 9, with a wide range of extensions and a
very portable system for sharing KQ macros.  My particular scripts will not
solve your current problem, but they might be useful models if you really
want to "do it on the cheapy-cheap" (which I applaud, and encourage.)
Nothing wrong with using perfectly fine tools, even if they are a little
dated.

[2] I only just here, as I am -- intentionally -- a "slow adopter".  This is
most especially true for FileMaker, since I firmly believe they lagged too
far behind in DB innovation for too many years.  It took version 7 to get
tools being feature requested since version 4.  And still, FileMaker has not
opened up the ScriptMaker editor.  That editor should always have been able
to be treated like a big text box -- with text editing of scripts rather
than this scroll-double-click to add steps.  I want to use any editor I want
to write FM scripts    So, I feel you on upgrading FileMaker, and I have
vowed not to upgrade past 7 (even though even more nice features are present
in FM 8 ... my life is SQL now, and FM just doesn't "hang" in that world.)

ATOM RSS1 RSS2