Insert Picture (Store reference only) in a container field using AS

Hi Experts,

I need a little help here. I have a database called “teste1.fp7” with a table called “table1” with a layout called “picstore” and finally a field called picture and i need to insert picture (BTW just store the reference) with a file (pic) that i have in this path “Tiger:Users:megaboss:Desktop:storepic:pic001.jpg” using applescript.

I’ve tried this one but i got errors.

tell application “FileMaker Developer”
set foo to “Tiger:Users:megaboss:Desktop:storepic:pic001.jpg”
set (value of cell “picture” of current record of table “table1” of layout “picstore”) to a reference to file foo
end tell

Any ideas??

BTW i’m using FMP 7

Thanx a lot

Andre Tozzini

It doesn’t need (or want) the extra “reference to” clause. Setting a FileMaker container to a file is always “as a reference only.” In fact it’s difficult to completely “embed” a graphic unless you use some other tool (such GraphicImporter OSAX). Also, it’s “cellvalue” not plain “value”. But neither is needed in this case. This works:

tell application “FileMaker Developer”
set foo to “Tiger:Users:megaboss:Desktop:storepic:pic001.jpg”
set cell “picture” of current record of layout “picstore” to file foo
end tell

Also, layout alone specifies the table (occurrence); “table” is actually “table occurrence” (the boxes on the Relationship Graph, NOT the table names you defined in the Tables tab. Kind of misleading, but you wouldn’t want to have to type “table occurrence” in AppleScript). The Tables you define in the tab are actually “base tables.” Layout are assigned to table occurrences.

Hi Fenton,

Well i’ve tried the script that i sent to me but i got this error:

"FileMaker Developer got an error: Can’t set cell “picture” of current record of layout “picstore” to file “pic001.jpg”

can you help me with that…

Andre Tozzini

Check the file path and layout name. It does work. I can’t see what else could go wrong.

Thanx a lot fenton

It works…

The path was wrong…

Thanx again

Andre Tozzini

Fenton,

Now i´m trying to do the same thing but now using FMP 6 and i got some errors, is there any diferencies between the 7 and 6 of that script???

Can u help me again??

Thanx a lot

Andre Tozzini

No, version 6 is much the same. Obviously don’t use any “table” references. Also, if it’s FileMaker Pro, don’t say “FileMaker Developer” (especially if you have both, one in 6, the other in 7).