Newbies antman Posted January 22, 2005 Newbies Posted January 22, 2005 I want to bulk import jpeg images into a container field. I have found some posts related to this but could not figure out how to make them work in my case. I have created an AppleScript that downloads images from the web and renames them "product_ID.jpg" (where Product_ID is a field in the database). 1) I would prefer to have this AppleScript insert the image into the container at the same time it is downloading the file. Otherwise, 2) Importing the images from the folder they have been downloaded into would be fine. Or 3) If there is a way to have FileMaker download the image directly into the contianer field would be really nice. I would like to import the images as opposed to using a ref to the image (but I would still like to know how to do the ref version too). Any help you can provide will be greatly appreciated. AntMan
Newbies antman Posted January 23, 2005 Author Newbies Posted January 23, 2005 I have figured out something that works. The line of AppleScript code that works is: set data cell "Image" of record i to alias CurrentPath Where 'Image' is the name of the field in the database, 'i' is the loop variable and 'CurrentPath' is the path to the file on my hard drive. If anyone knows any other ways of bulk importing images into FileMaker I am happy to see them, especially methods that bring images into Filemaker straight from the web.
Fenton Posted January 23, 2005 Posted January 23, 2005 I believe the above will set the image in as a reference. In 6 you used to be able to "read" the file "as JPEG", then embed that into a container field. But it doesn't work in 7, at least not for me, unless there's some other way to reference/convert the image. What I've been using is the GraphicsImporter OSAX (Scripting Addition), which is free, from: http://www.macscripter.net It has simple commands to get an image; also to resize images. It appears to only produce JPEG however (though it says otherwise). But since this is almost always what I want, I can't complain. There are other graphics tools and apps, but this one is the simplest. If anyone knows how to sweet talk Image Events into doing this, please share. I can get it to do files fine, but not produce something I can embed into FileMaker 7. set theFile to (choose file with prompt "Choose the picture file to import
Fenton Posted January 23, 2005 Posted January 23, 2005 Also, look at the AppleScript dictionary (Script Editor: Open -->Dictionary) of URL Access Scripting: download: Downloads a specified URL to a specified file download string -- URL to download from to file specification -- the downloaded file location Yes it downloads to a file, I don't know if (or how) you can capture the image without creating a file; out of thin air :-] If you don't want the file, you could put it in the "temporary items" folder: path to temporary items Download an icon off my web site (which I drew myself :-) set newFile to (((path to desktop) as string) & "Canna.jpg") as file specification tell application "URL Access Scripting" download "" to newFile end tell
Newbies antman Posted January 23, 2005 Author Newbies Posted January 23, 2005 Fenton, You are right. My line of code was only setting a reference to the image. I tried your code with the GraphicsConverter OSAX addition and it seems to have imported the image. Thanks. Also, I tried your download code using "URL Access Scripting" and it worked great. I was using the Terminal's "curl" command via "do shell script" command. It is nice to know there is another way of doing it. Thanks for your help. P.S. -- Nice graphic.
Recommended Posts
This topic is 7313 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