Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Write field contents to a file?

Featured Replies

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?

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

  • Author

Many thanks for that, Fenton.

I shall be studying your examples to learn from them...

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.