FMWebschool Posted March 3, 2005 Posted March 3, 2005 I have a client that has thousands of images stored in container fields in a FileMaker solution. He would like to be able to "using Applescript" export images from his container fields and save them to a file. He has thousands of images. I would be extremely grateful for any help! In Kindness
nut Posted March 3, 2005 Posted March 3, 2005 I assume, based on your question, that the images are imbedded in the database, and not stored as references. In that case, you can copy the image (which was converted to a PICT when it was inserted in the container field) paste it into an imaging program like GraphicConverter, Illustrator, or Photoshop, and save/export the new image. It helps if you have a field in the database that you can use to create a filename, otherwise you have to build that into the AppleScript. What kind of images does your client want to end up with? JPEG? GIF? Something else? And will the AppleScript be run in an OS 9 or OS X environment? For image references in container fields, you can find the image path via AppleScript and open and then export the images to another format/location as well. Let me know which process if more useful and I'll dig up some sample code. Illustrator is quite scriptable beginning with v. 9, and GraphicConverter is great for this kind of scripting. -Megan
Fenton Posted March 3, 2005 Posted March 3, 2005 [You could do a search and probably find an example file here with this whole business in FileMaker 6. In a fit of housecleaning I threw away my original version 6 file; I only have a version 7 one.] It is possible to get an embedded container out of 6 as a PICT file with "vanilla" AppleScript, but it's tricky, and rather a large file. If the client is content to get JPEG, then there is a Scripting Addition which can do it much easier. GraphicsImporter. Put it in their "Library:Scripting Additions" folder, or in their User folder of the same relative location. tell application "Finder" activate open (path to scripting additions from user domain) end tell http://osaxen.com/graphicsimporter.html The following AppleScript will put them in a folder on the desktop, named by the database (or create it if it's not there). I made a few comments at the end of the script. GraphicsImporter says it will do other formats, GIF, etc., but I've only had luck with JPEG. It would best be run in a Perform AppleScript step. That's why the - tell "FileMaker Pro" block is commented out; uncomment to view in Script Editor. Run in a Loop to do multiple records. You must have those FileMaker fields, on the current layout. The "filePath" field can be a calculation, combining the user's desktop with the folder name & ":" & the file name. Get the user's desktop into a global field with: set cell "Desktop" to (path to desktop from user domain) as string Another possibilty is to get a trial version of FileMaker 7. If it allows export you can use Export Field Contents. Of course, it's just as much work with AppleScript, to rename/move the file each time. -- tell application "FileMaker Developer" tell current record of window 1 set txtPath to cell "filePath" set imageCell to cell "Image" set folderName to cell "folderName" end tell -- end tell tell application "Finder" if (folder folderName of desktop exists) is not true then set newFolder to make new folder at desktop with properties {name:folderName} end if set thePath to txtPath as file specification end tell set theImage to giconvert imageCell type "JPEG" image thePath -- requires GraphicsImporter OSAX -- set theImage to giconvert imageCell image thePath -- creates PICT file, huge -- doesn't seem to work to create "GIFf" or "PDF " files, but will do them as JPEG
FMWebschool Posted March 3, 2005 Author Posted March 3, 2005 Thank you so very much! The gentleman has thousands of images stored, embedded in FileMaker. I believe I would like to just do a quick FileMaker Seven conversion and then run the applescript. Thank you to everyone for all of your helpful suggestions. I will let you know how it turns out. Thank you once again! In Kindness
Recommended Posts
This topic is 7204 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 accountSign in
Already have an account? Sign in here.
Sign In Now