Re: Set value of FileMaker container?
Re: Set value of FileMaker container?
- Subject: Re: Set value of FileMaker container?
- From: Kai Edwards <email@hidden>
- Date: Wed, 20 Mar 2002 16:27:27 +0000
on 19/3/02 11:01 pm, Paul Scandariato at email@hidden wrote:
>
on 3/19/2002 9:47 AM, Kai Edwards <email@hidden> wrote:
>
>
> I tried extracting the raw data from an EPS file, but FileMaker didn't
>
> really appreciate that! However, it occurred to me that FMP has access to a
>
> bunch of translators that might be press-ganged into service - with a little
>
> persuasion. (Hopefully "Barcode Producer" can create Mac EPS files, since
>
> these seem to be the flavour that FMP finds easiest to digest.)
>
>
From what I can tell after several hours of testing, FMP simply doesn't like
>
having the EPS files from Barcode Producer passed over via AppleScript. I
>
instead tried this, which seems to work at a base level:
(snip - TIFF transfer details)
>
Even without using Barcode Producer, I was unable to pull in an EPS where a
>
regular TIFF file worked flawlessly. I'll need to do more checking to see if
>
it's related to the EPS itself, or if its a general FileMaker problem. I'd
>
imagine the latter is the case, since I can insert a Barcode Producer EPS
>
using a FMP script without any problems at all, which is why the following
>
works as well.
On a straight import, my copy of FMP seemed to easily handle Mac EPS, TIFF,
PostScript and QuickTime PICT files. It also imported other PICT files
(albeit with some eccentricities - the resulting pictures were tiny)!
However, it declined to work with MS-DOS EPS and Generic EPS files. (FWIW, I
used FreeHand to create most of the test files.)
Now I get the impression that FMP may use the same graphic converters to
implement the 'set cell' command for a container field. All the graphic
formats referred to above behaved in the same way for me when I tried:
--------------------------------
tell application "FileMaker Pro"
set cell "barcode" of current record to file barcode
end tell
--------------------------------
... in other words, I could successfully use 'set cell' to place Mac EPS,
TIFF, PostScript or QuickTime PICT files directly into a FileMaker container
field.
These results would seem to call into question the type of EPS created by
Barcode Producer. However, since you can insert an EPS created by Barcode
Producer using a FileMaker script, I'm really at a loss for an explanation.
However - not to worry. If all else fails, read on...
(snip - original suggestion for transfer via Finder/FMP import)
>
This is just the concept I needed to get it going -- I was able to simplify
>
your script further using Barcode Producer's own 'target' property:
>
>
tell application "FileMaker Pro"
>
set n to get cell "number" of current record
>
end tell
>
>
tell application "Barcode Producer"
>
set barcode to Code39 n ,
>
target "Macintosh HD:FMP Imports:Stage2:barcode.eps"
>
-- replaces existing file
>
end tell
>
>
tell application "FileMaker Pro"
>
do script "import barcode" -- goes right to Stage2:barcode.eps
>
end tell
Of course, I didn't realise "Barcode Producer" would be able to do that -
but it's a much better option!
>
> ---------------------------------------------------------------
>
> [1] Depending on the path defined by "Barcode Producer", you may need to
>
> coerce 'barcode' to an alias - using something like '(barcode as alias)'.
>
>
Right now, it returns a file path as a string, which can be easily converted
>
to a file reference by using "file (barcodepath)".
Great. That's another problem out of the way. :-)
>
Is it perhaps possible to use AS to send a FMP script a parameter? This would
>
allow the above script to operate (provided it created the folders) without
>
any configuration on another machine.
Not that I'm aware of. To make FileMaker easier to use, it normally stores
certain parameters (find, sort, import, etc.) internally. This approach
greatly simplifies general, everyday tasks - but may rather limit
flexibility when it comes to more ambitious work. (Not that I'm really
complaining. There's usually some way around such restrictions!) ;-)
When I read your original query, I actually tried to find a way of sneaking
a parameter (in this case, a file location for the import function) through
the back door. My initial idea was to get FMP to search out the required EPS
file's location (based on info passed by the script) - and then import that
file's data. However, it was my inability to do this that prompted the
notion of using the Finder as mailman, leaving FMP to simply pick up the
data from the same address every time.
>
The overall intention is to allow others to configure this on their own
>
machines without much trouble. It always seems to complicates things with
>
AppleScript when you have to ensure it works everywhere...
One approach I sometimes use to get around this problem is to bundle all the
relevant files (including the script) into one folder. Then I configure the
script to locate all the files that it needs to reference - based on their
relative location (using 'path to me' as the starting point). Apart from any
OS/AS/OSAX variations, it then shouldn't really matter on which machine the
folder ends up - or where it's buried on a volume. (If necessary, the script
could even create a desktop alias of any file[s] relevant to the target user
- which he/she could then move to a preferred location.)
I believe you can extend this trick to FileMaker - because much of its
referencing seems to be based on the location of files relative to the FMP
file in question.[1]
So the way I would probably approach the problem is to create a master
folder to accommodate the script, FMP barcode database and "FMP Import"
folder (containing the "barcode.eps" file).
Obviously, Barcode Producer's 'target' property effectively makes the 2
'stage' folders redundant. (In fact, you may now feel it unnecessary to
create any extra folders at all - since the master folder itself could act
as the container folder for the "barcode.eps" file.)
One further possible refinement: If you embed the AS script in the database
itself, you could end up with a master folder containing just the database
and the current "barcode.eps" file. (Be aware though that, if your script
needs to use the "path to me" function, the path returned in this case would
lead - logically enough - to the FileMaker Pro application. Any FMP
referencing, on the other hand, should remain relative to the FMP file.)
>
BTW, Barcode Producer is my application (should have mentioned that
>
earlier), for which I'm currently adding AppleScript support for, along with
>
a bunch of FileMaker examples. I've had no problem with the technical end of
>
making it scriptable, my real trouble is usually figuring out the logic
>
behind the dictionaries for other scriptable applications like FileMaker --
>
which is why I asked here, as oppose to the AppleScript developers list.
Yeah. I find dictionaries a useful starting point - when I haven't a clue
where to start (which is all too often the case)! But it seems I still need
to experiment a lot with syntax before I get a result close to what I'm
looking for! (I sometimes wonder if the inclusion of a brief example for
each dictionary term might be more helpful to 'the rest of us'...)
>
Thanks very much for the help!
No problem, Paul. I hope these additional notes also help - but let me know
if you run into any further snags!
Best wishes.
Kai
----------------------
[1] BTW, I've since carried out a brief test of the FileMaker referencing
principle on 2 separate volumes - and it worked for me!
Oh - one final note. If you move the files or folders around on the *same*
volume, it looks like FileMaker treats any internal file reference more as
an alias - and apparently tries to track down the file originally specified.
It's when the database and associated files are moved to a different volume
that FMP seems to resort (initially at least) to using a relative path. (I
hope that makes some sense.) These are just my impressions from a few
cursory tests - not conclusions drawn from exhaustive trials! :-P
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.