August 1, 200421 yr Newbies Hi, I need to export into multiple files (several thousands, xml-files for flash-application, one by one record). "Export field contents" works fine within a loop, but it overwrites one and the same file over an over again. Is there any chance I can control the export file's name by a field's content of the active record? Any other solution at hand? TX a lot!
August 1, 200421 yr You can use applescript to rename the files after you export them. Or, if you don't want to use applescript, you could use a plugin like the Troi file plugin to do the same thing.
August 1, 200421 yr The Mac UNIX foundation comes in handy here. You can use the Abstrakt.com shell plugin for this or the the applescript "do shell script" command. Assuming you have a folder ExportFiles on your desktop this script exports a single record, put it inside a loop to export all records in the found set. perform applescript copy cell "filename" of current record to fileName copy cell "ExportMe" of current record to exportMe do shell script "echo " & quoted form of exportMe & " > ~/desktop/ExportFiles/" & quoted form of fileName
August 2, 200421 yr Author Newbies Thanks a lot! I first tried the troi plugin (3.0b2) and it worked, but unfortunately it does not seem to support utf-8 or utf-16. AppleScript than did the trick for me -- I used the export field contents loop and had to add just a single row with "perform apple script" to rename the exported files. Works fast and smooth between FM and Finder, no timing problems. First time I used AppleScript. The Apple Script is something like: "tell application " & """Finder""" & "
August 2, 200421 yr Did you try the applescript method using the shell script as supplied? You don't need to use the export field command or rename the file afterward, it does the whole operation and can dynamically name and locate the files. I have attached an example in FM6 format. The scripts have been updated to handle unicode text. ExportByShell.zip
Create an account or sign in to comment