Getting an Image into a Filemaker

Can someone give me a hand here. I’m trying to take an image I’ve saved from my webcam (saved as a jpg) and paste it into a container field in Filemaker. Here’s what I’ve got so far:

tell application "EvoCam"
	capture now
end tell

set thisFolder to path to pictures folder
set thisFile to ((thisFolder as string) & "webcam.jpg") as alias

tell application "FileMaker Pro"
		set cell "Photo ID" to thisFile
end tell

This didn’t work as it’s trying to put the file reference in, rather than the image itself. So I tried using Image Events:

tell application "EvoCam"
	capture now
end tell

set thisFolder to path to pictures folder
set thisFile to ((thisFolder as string) & "webcam.jpg") as alias

tell application "Image Events"
	launch
	set thisImage to open thisFile
	tell application "FileMaker Pro"
		set cell "Photo ID" to thisImage
	end tell
	
end tell

But this didn’t work either. Can someone point me in the right direction please?

thanks,
B

You didn’t say what version of Filemaker. Since it didn’t work, I’m assuming version 7. For some reason the usual methods don’t work with 7. What I’ve found does work is to use the GraphicsImporter OSAX (here at macsripters).

set theFile to (choose file with prompt “Choose the picture file to import…”)
set FileRef to theFile as string
tell application “Finder”
set FileName_ to name of theFile as string
end tell

set theImage to giconvert theFile

tell application “FileMaker Developer”
activate
tell current record of document 1
set cell “FileName_” to FileName_
set cell “File_” to theImage
set cell “FilePath_” to FileRef
end tell
end tell

Fenton Jones
http://fentonjones.com

If you are using FMP 7 then you need to address the record of the layout of the window of Filemaker.
Confusing right?

Code:
tell application “FileMaker Developer”
tell window “imagetest”
tell layout “imageviewer”
set imagepath to cell “imagepath” of current record
set imagepath to imagepath as alias
try
set cell “image” of current record to imagepath
end try
end tell
end tell
end tell

This is because FMP7 is acting like a real Database. The Record is tied to the Layout. The Layout is tied to the Table. The Table is tied to the Window and the Window is tied to the App.
The only other suggestions I have would be to check your path to the image. Be sure it is right. You can try hard coding in an image to test. My image paths are placed within FMP but as long as you set it to alaias you should be fine. Let me know if this helps.

Tater

I forgot…
I use the try statement because the sample script actually part of a repeat and I want it to continue instead of stopping at an error.