October 1, 200619 yr How (using FM8.5 on MacOSX 10.4) can I most speedily get a file written to disc containing the contents of one or more FM fields, with a filename (and preferably path) taken from fields in the same record? The full Applescript would be much appreciated, as I know less about AS than about FM http://fmforums.com/forum/skins/Crisp/icons/wink.gif Is Applescript the best (or indeed only) way to achieve this?
October 1, 200619 yr There's more than one way to do this. It partly depends on what you want to export and what you want to get (vague but true). For example, if you have many records, and you want the result to be tab-separated text, with returns between records (and you have no returns in the fields), then a simple tab-separated export will do. If you have returns in the fields, then you'd need to post-process to translate ASCII 11 (FileMaker's internal returns in fields) to something else. You can name the file using a script Variable. I'm not going into that; too early in the morning, and I just did it yesterday -] But the fastest way to write a field, or a few fields, from the current record is to use the Perform AppleScript step, with a small shell script (first posted by Bruce Robertson). You'd need to use your field names. The shell translates ASCII 11 to returns automatically, within AppleScript anyway. ------------------------------------------------------- copy cell "filename" of current record to fileName copy cell "Text_" of current record to exportMe do shell script "echo -n " & quoted form of exportMe & " > ~/desktop/" & quoted form of fileName -- -n prevents a final line feed from being added ------------------------------------------------------- Here's a little file with a few variations. TextExport_Shell_1.zip
October 2, 200619 yr Author Many thanks for that, Fenton. I shall be studying your examples to learn from them...
Create an account or sign in to comment