Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

Posted

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]

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

Posted

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.

Posted

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]

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

Posted

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...
Posted

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.

Posted

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

  • 5 months later...
  • 6 months later...
Posted

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...

This topic is 7422 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.