Re: Importing a Folder full of Media Files
Re: Importing a Folder full of Media Files
- Subject: Re: Importing a Folder full of Media Files
- From: Ehsan Saffari <email@hidden>
- Date: Sat, 28 Apr 2001 05:48:10 -0600
On 27/04/2001 27/04/2001 19:44 -0400, Larry Bartram <email@hidden>
wrote:
>
I'm hoping that someone has developed a simple script to import all of the
>
media files in a folder (including subfolders) into FileMaker Pro 5
>
Container fields. Of course, these should be references to the original
>
files, not the entire sound/picture/movie.
>
>
Any scripts would be appreciated. I've worked on and off for almost 6 months
>
on this with no success.
The basic idea is found in the Apple Events Reference database.
Here is my code that handles top level contents of a a folder, it is
assumed that all files in the folder are supported image types that FMP
handles:
Save as an applet (do not stay open, never show startup) and drop a
folder on it.
------------------written by ehsan saffari, June 21,
2000------------------
global namelist, imagelist,thetime
on open of myFolder
set namelist to {}
set imagelist to {}
set thetime to current date
try
set theList to (list folder myFolder without invisibles)
repeat with aFile in theList
set thefilepath to (myFolder & contents of aFile) as string
set thefile to file thefilepath
set namelist to namelist & aFile
set imagelist to imagelist & thefile
end repeat
tell application "FileMaker Pro 3/4/5"
tell document "Templates"
repeat with x from 1 to count of items in namelist
create new record with data {item x of namelist, item x of imagelist}
end repeat
end tell
end tell
set thetime to (current date) - thetime
tell me to activate
display dialog (thetime & " seconds for " & (count of items in namelist)
&,
" images") as string buttons {"OK"} default button "OK" with icon 1
on error e number x
display dialog e & " Error Number " & x
end try
set {namelist, imagelist, thetime} to {"", "", ""}
end open
------------
IMPORTANT: the two fields (namefield,imagefield) are the only fields on
the layout and inserted on the layout in that order.
---------------------------------------8<----------------------------------
-----
cheers
ehsan