On May 12, 2009, at 2:26 PM, Deborah Tinsley wrote:
Is there any way to batch export images from the FMP database into
a new
file?
It sounds like you basically want to send someone all the original
image files of your FileMaker container fields, which have been
Inserted [x] As reference only.
This should not be too difficult. The FileMaker syntax path to the
file is the last line of GetAsText ( container field ). You can
convert that to a Mac path, or a Unix path. Then, in a Perform
AppleScript step, use either the "vanilla" AppleScript command
"move", or the Unix command "mv". Either one should be pretty fast.
When you just move the file you do not open it, nor does its size
really matter. You aren't actually "moving" the file, you're just
telling the OS to look for it somewhere else.
You're only using FileMaker to tell AppleScript the path, and you're
only using AppleScript to move the files to another folder. So it
should go pretty quick.
You could then send the folder, or burn it, or zip it (but that would
take a long long time). But do that outside FileMaker. In fact, close
your database first, just for safety; it will no longer be able to
see the pictures anyway, until you put them back.
When you're done with all this, just select all the files, then move
them back into the original folder, so FileMaker can see them again.
Or write a little AppleScript to do it (the Finder might have trouble
selecting/moving 3500 files at once). Example:
tell application "Finder"
move files of (choose folder) to choose folder
end tell
Here is a FileMaker calculation to convert a reference image path to
an AppleScript path (text). I would create a field with this
(unstored), so I could easily reference it from Perform AppleScript.
Let ( [
txt = GetAsText ( Contain );
FM_path = GetValue ( txt; ValueCount (txt) )
];
Substitute ( FM_path; ["imagemac:/"; ""]; ["/"; ":"] )
)
So then you just need the Mac syntax folder path (text), which you
can see with:
(choose folder) as text
Then you'd run Perform AppleScript with this info, to move the file.
You'd run this in a FileMaker script, using Loop to go thru the
records, one at a time. (Alternatively, you could export all the
paths to a text file, and use that as the source paths; but I'd just
do the Loop. FileMaker runs AppleScript very well.)
Do not do this on a layout which has the container field; you do not
need to load it, and it would take a lot longer. But do have the
calculated paths on the layout, as it is much easier to target them
with AppleScript if they are on the current layout; though that's not
necessary if you use a calculation for the AppleScript also:
If you used a calculation field as the path, with a calculation field
for the AppleScript, it would look something like this:
"tell application \"Finder\"¶
move alias \"" & _cMac_path & "\" to folder \"Macintosh
HD:Users:fej:Desktop:Images:\"¶
end tell"
Fenton Jones
FileMaker Development
1728 Meade Ave
San Diego, CA 92116
619-692-1529
http://fentonjones.com