I’ve about a 1000 .csv files. (comma separated files)
I want those files in a databases using an Applescript.
But I can’t import a file to FileMaker.
Andre
tell application "Finder"
set FolderLijst to choose folder
set MijnLijst to every file of FolderLijst whose name contains "csv"
tell application "FileMaker Pro"
repeat with i from 1 to the count of MijnLijst
get name of item i of FolderLijst
-- do import?
end repeat
end tell
end tell
As far as I know you can’t pass a file reference to the filemaker import script. The csv files would have to converted to filemaker files before they could be imported via applescript (that can be done) but no point since if you have to do that you may as well use the import command and import each file seperately.
The above method “reads” the files, then just creates new records with the data, one line at a time. I think it works fastest when you have numerous small csv files.
There are other methods, which involve stepping through the folder, renaming each file to a fixed name (which is pre-entered in a FileMaker Import step), then importing, renaming/move the file back again, then continuing.
Finally, in FileMaker 8 there is the ability to set a file path (in FileMaker syntax) into a Script Variable. This can then be used as an Import file reference, giving us (finally) a dynamic method within FileMaker.