Jump to content

Insert Pictures in FM with AppleScript


This topic is 7727 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi everybody,

I wanna insert pictures in FM database via AppleScript, but not the reference of the file. I know the database is going to be heavy, but I really need having the picture in the database and not its reference.

I made an AppleScript (see code below), but it only store the reference of the picture. What can I do and how can I modify my AppleScript to insert the picture and not its reference.

Thanks for your help

Jave

Code of my AppleScript

tell application "Finder"

set finalFolder to "Macintosh:Utilisateurs:jave:Bureau:Images"

repeat with x from 1 to (count of every item of folder finalFolder)

set mapPart to item x of folder finalFolder

set partName to name of mapPart

tell application "FileMaker Pro"

activate

tell document 1

set currentRecord to create new record

tell currentRecord

set cell "Image" to file (mapPart as string)

set cell "NomFichier" to partName

set cell "Ville" to "Basel"

end tell

end tell

end tell

end repeat

end tell

Link to comment
Share on other sites

When I recently wrote an AppleScript to import a folder of images, I handled it differently.

AppleScript looped through each file in the folder. For each one, it made a copy in a known location and called it image.jpg. FileMaker then used the Insert Picture command to import image.jpg into the correct field. The next time through the loop, image.jpg held the next file in the folder.

Chuck

Link to comment
Share on other sites

There are others ways to do this but I recommend using the giconvert command from the GraphicsImporter scripting addition. You can get the scripting addition at http://osaxen.com/graphicsimporter.html

After you download the addition, place it in the scripting additions folder in the system folder. The syntax is something like...

set theImageData to giconvert theImageAlias

tell app "FileMaker Pro" to set cell "Image" to theImageDate

Link to comment
Share on other sites

This topic is 7727 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.