Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Inserting Pictures into FM Pro

Featured Replies

How can I insert an image into a FM Pro database using applescript so that the image loads not the reference to the file? The following command will insert a reference to an image.

set cell "Image" to file Test_Image

Thank you.

ss

quote:

Originally posted by Scott Schley:

How can I insert an image into a FM Pro database using applescript so that the image loads not the reference to the file?

You need to "Import" the image.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Senior Filemaker Developer

http://www.database-resources.com

mailto:[email protected]

=-=-=-=-=-=-=-=-=-=-=-=-=

  • Author

After looking through the FMP Applescript dictionary, if I understand correctly, there is no way for me to import the data from an image file into a FMP field using AppleScript. Is this correct? My understaning is that Import is a FileMaker command that is not scriptable.

Thank you for your help.

quote:

Originally posted by Scott Schley:

After looking through the FMP Applescript dictionary, if I understand correctly, there is no way for me to import the data from an image file into a FMP field using AppleScript. Is this correct? My understaning is that Import is a FileMaker command that is not scriptable.

Hmm, I am not a big AppleScript guy, but this could be correct. However you should be able to run a FMP script which has the Import Picture command within it.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Senior Filemaker Developer

http://www.database-resources.com

mailto:[email protected]

=-=-=-=-=-=-=-=-=-=-=-=-=

quote:

Originally posted by captkurt:

Hmm, I am not a big AppleScript guy, but this could be correct. However you should be able to run a FMP script which has the Import Picture command within it.


The problem with using the Import script step in FileMaker is that you can't specify on the fly what the name of the file is. FileMaker saves the name and location of the file, or presents the user with a dialog to select it. Neither of these solutions may be acceptable to you.

I had a project recently where that was the case. What I came up with was using AppleScript to duplicate the file to be imported and saving it to a known location with a known name, but storing in a variable the original name and location. I then imported the graphic using the Import script step in FileMaker, and also set a text field to the path to the original file.

Chuck

  • 2 years later...

Try this:

set cell "ActualPicture" to (file cell "filepath")

Where the filed named "ActualPicture" is a container for the graphic and the field "filepath" text containing the path to the graphic.

If you want some freedom to move the folder full of graphics around, you could set a global with the base of the path upto but not include the file name, then build the final path on the fly.

You could use applescript to put a selected file at a designated location and then use the import script step to import the file into FM. A better method is to use a scripting addition to get the PICT data and set the FM field to the PICT data. The result is an internal stored image in FM. Akua Sweets will work, but GraphicsImporter (available at http://osaxen.com/graphicsimporter.html ) will run on OS 9.x and OS X. A sample import script using GraphicsImporter is

Has anybody tried the GraphicsImporter (or Akua) approach?

  • 5 months later...
  • Newbies

Tried the GraphicsImporter approach (version 2.2). Works great - thanks for the tip!

  • 6 months later...

thanks guys that's wicked, I love this forum!!! smile.gif

tell application "FileMaker Pro"

set theCode to cell "code" of current record of database "images"

set theFilePath to {"Macintosh HD:Users:chris:Desktop:Images:" & theCode}

set the cell "image" of current record to (file theFilePath)

end tell

'code' is filename (it's all based on codes, so we know it'll be code.jpg)

images stored in 'Images' on desktop

filepath created (could be from a global as someone suggests)

set the cell to (file theFilePath) is a v nice way of field based importation. Very quick discreet and efficient. No renaming or random moving. Nice one Clint. I was trying the renaming and moving route before, with FileMakers slower import pic.

Another script I ended up using looked like this (in case someone is needlessly sweating over code, I would have loved more to have been available!):

tell application "FileMaker Pro"

--STICK IMAGE IN FILEMAKER

set theFilePath to cell "TempFilePath" of database "images"

--get tempfilepath which is a global, in this case = Macintosh HD:Users:chris:Desktop:Undone:temp.jpg

set the cell "image" of current record of database "images" to (file theFilePath)

--put image into FileMaker

--RENAME IMAGE BY CODE AND STICK IN DONE FOLDER

set theCode to cell "uniqueID" of current record of database "images" & ".jpg"

--get suffix for the future name of file

set FinalFilePath to cell "FinalFilePath" of database "images"

--get FinalFilePath which is a global, in this case = Macintosh HD:Users:chris:Desktop:Done:

end tell

tell application "Finder"

move file theFilePath to folder FinalFilePath with replacing

set the name of file (FinalFilePath & "temp.jpg") to theCode

end tell

=====

nice one & the looks of that graphicsconverter is just the tick...

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.