philipcaplan Posted October 1, 2006 Posted October 1, 2006 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?
Fenton Posted October 1, 2006 Posted October 1, 2006 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
philipcaplan Posted October 2, 2006 Author Posted October 2, 2006 Many thanks for that, Fenton. I shall be studying your examples to learn from them...
Recommended Posts
This topic is 6625 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now