Jump to content

Mass Import of Images and names


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

Recommended Posts

I am trying to import 5500 images and names into a database. I made a database with a text field and container field. Below is my script. The container field won't import. I don't want a reference to the field I want the actual picture placed in the field. Please help! Below is my script:

tell application "Finder"

-- change the following to suit your own folder name

tell folder "Elements"

tell folder "!logos"

set myfolder to "Desktop:Elements:!logos"

set app_path to every item

repeat with this_item in app_path

set fileName to the name of this_item

set filepath to (myfolder & ":" & fileName)

tell database of application "FileMaker Pro"

create new record with data {fileName, filepath whose file type is "TIFF"}

--set cell "container" of current record to (a reference to filepath)

--set cell "name" of current record to fileName

end tell

end repeat

end tell

end tell

end tell

Link to comment
Share on other sites

My first question has to be why do you not want to store the images as references to files? There are numerous advantages to that approach...

But if you want the images stored internally and you are using 9.x, you can try Akua Sweets scripting addition. This will allow you to convert your image (as long it is a QT supported format) to the PICT data FM uses. You can then set the FM container cell to the PICT data. You first must download and install Akua Sweets (check www.macscripter.net). My trial script follows...

set theAlias to choose file

set theImage to the image from theAlias

tell application "FileMaker Pro"

set cell "container" of current record to theImage

end tell

You will need to modify this to your script. Good luck.

Link to comment
Share on other sites

I am importing the pictures because I am printing pieces directly from filemaker to a press. I need to have the images availab.e I am not sure how to use the akusweets - I found the store image command, but it doesn't seem to work. I am not sure if I am writing it right. See below:

tell application "Finder"

tell folder "Macintosh HD:Elements:!logos:done"

set myfolder to "Desktop:Elements:!logos"

set app_path to every item

repeat with this_item in app_path

set fileName to the name of this_item

set filepath to (myfolder & ":" & fileName)

store image filepath in "Macintosh HD:Elements:!logos:done:converted" as "PICT"

end repeat

end tell

end tell

Link to comment
Share on other sites

Hey batgirl

You just need to get the image data from your source file, and then set the cell to the image data. It will be PICT image data. Akua has QT takes care of the conversion. Modifying your original script...

tell application "Finder"

-- change the following to suit your own folder name

tell folder "Elements"

tell folder "!logos"

set myfolder to "Desktop:Elements:!logos"

set app_path to every item

repeat with this_item in app_path

set fileName to the name of this_item

set filepath to (myfolder & ":" & fileName)

set theAlias to alias filepath

set theImage to the image from theAlias

tell database of application "FileMaker Pro"

set newRec to create new record

set cell "container" of NewRecord to theImage

set cell "name" of NewRecord to fileName

end tell

end repeat

end tell

end tell

end tell

I hope this helps.

[i still don't see any reason why you can't use image references. You can use your script to move the image to a network location available to the computer doing the printing. There can be some complications if you are in a cross-platform environment, but that can be accommodated.]

Link to comment
Share on other sites

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