Jump to content

Write field contents to a file?


This topic is 6440 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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?

Link to comment
Share on other sites

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 :D-]

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

Link to comment
Share on other sites

This topic is 6440 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.