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: Tue, 19 Mar 2002 14:47:44 +0000
on Mon, 18 Mar 2002 23:18:43 -0500, Paul Scandariato
<email@hidden> wrote:
>
I'm trying to write an AppleScript that snags the current value of a field
>
in my FileMaker database, sends the value to another application to be
>
turned into an EPS barcode image, then places that barcode image in a
>
container field. This is what I have so far:
>
>
tell application "FileMaker Pro"
>
set n to get data cell "number" of current record
>
end tell
>
>
tell application "Barcode Producer"
>
set barcode to ISBN n -- returns a path to EPS file
>
end tell
>
>
tell application "FileMaker Pro"
>
stuck here ->> set data cell "barcode" of current record to file (barcode)
>
end tell
>
>
I can't figure out how to convince FileMaker to accept a file reference as a
>
picture that can be placed in a container.
I don't know if ehsan (who disseminates very sound FMP advice) can give you
a few pointers here, Paul.
Anyhow, in case you don't get any better tips, here's a workaround that
might help...
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.)
Because my method uses the Finder to copy files, it isn't very fast - but
(OMM) it does at least work! (I'm currently testing some work on quite an
old system - so there may be more efficient ways getting the Finder to do
its stuff - I haven't checked).
I also thought it might be better to keep any obvious Finder 'rummaging' off
the desktop - so I've tucked away the relevant files and folders in my
version.
To get the whole thing working properly, you'll need to do a bit of
preparatory homework in the Finder - as well as in FileMaker itself:
---------------------------------------------------------------
Finder preparation
---------------------------------------------------------------
1) Make a new folder (where you think best) called, say, "FMP Imports"
2) Make 2 more folders within that, perhaps called "Stage1" & "Stage2"
3) Copy any EPS file and change the copy's name to, say, "barcode.eps"
4) Place the renamed file in the "Stage2" folder
---------------------------------------------------------------
FileMaker preparation
---------------------------------------------------------------
1) Create a new script called something like "import barcode"
2) In the new script, define the following commands:
Go to Field ["barcode"] -- required for import
Import Picture ["barcode.eps"] -- the file in "Stage2"
Go to Field [] -- unspecified (to deselect field)
---------------------------------------------------------------
AppleScript
---------------------------------------------------------------
property stage1 : alias "Macintosh HD:FMP Imports:Stage1:"
property stage2 : alias "Macintosh HD:FMP Imports:Stage2:"
property fileName : "barcode.eps"
tell application "FileMaker Pro"
set n to get cell "number" of current record
end tell
tell application "Barcode Producer" -- untested by me!
set barcode to ISBN n -- returns a path to EPS file
end tell
tell application "Finder"
set theCopy to duplicate barcode to stage1 -- [1]
set name of theCopy to fileName
move alias ((stage1 as string) & fileName) to stage2 replacing yes
empty trash -- optional
end tell
tell application "FileMaker Pro"
do script "import barcode"
end tell
---------------------------------------------------------------
[1] Depending on the path defined by "Barcode Producer", you may need to
coerce 'barcode' to an alias - using something like '(barcode as alias)'.
BTW, I originally tried using an alias file of the EPS instead of
duplicating it - which promised to be a bit faster. But FileMaker
immediately tracked down the original item (which I suppose is logical for
an import command) - and thereafter imported the same file every time! (Ah
well...)
Anyway, I hope the suggestion works for you - and isn't too painfully slow
for your purposes. Maybe someone will come up with a better idea - and we'll
both learn something! :-)
Let me know if you have any queries.
Best wishes.
Kai
--
**********************************
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.