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.

Can I write data to a textfile using FMPro 16

Featured Replies

I have FilemakerPro 16, and I would like a script that does the following:
(1) opens a textfile on my computer, if it exists (or create it if it doesn't exist)
(2) writes the content of a field at the end of the file (ie, as a new final line)
(3) closes the textfile

Is that possible without a plugin?
If not, is there a cheap or free plugin that will enable this?

It is possible in version 18. In version 16, you can:

  1. Insert the text file into a variable;
  2. Read the contents of the file using the TextDecode() function;
  3. Append the contents of a field to the contents of the file;
  4. Encode the resulting text using the TextEncode() function and set a global container field to the result;
  5. Export the global container field, overwriting the original text file.

Alternatively you can use the (free) BaseElements plugin or OS-level scripting (AppleScript on macOS).

 

Edited by comment

  • Author

Thanks comment.  I downloaded the baseelements plugin, got a zip file which unzipped into a single item called BaseElements.fmplugin

I googled how to install it, but I couldn't get it to install by copying that file into Library>Application Support>Filemaker>Extensions 

Sent a message to the author of the plugin, but so far no reply.

So, I thought I'd try to use your suggestion in Steps 1 to 5, but in Script Workspace I couldn't see TextDecode in the script steps, so didn't understand how I could use it. Is a "function" another name for a "script step"?

Can you please give me a simpler explanation of how to create the script you describe.

Thanks.  Philip Caplan

Let me start with this:

48 minutes ago, philipcaplan said:

I couldn't get it to install

Make sure the file is installed exactly where it says in the help:
https://fmhelp.filemaker.com/help/16/fmp/en/#page/FMP_Help%2Finstalling-plug-ins.html%23

If you're not sure, open Preferences > Plug-ins and click `Reveal Plug-in Folder'. 

Once you have the file there, make sure it's enabled in the Preferences.

 

55 minutes ago, philipcaplan said:

I couldn't see TextDecode in the script steps, so didn't understand how I could use it. Is a "function" another name for a "script step"?

TextDecode() is a function. A function is different from a script step. Not to give you a hard time, but this is something very basic. I am taken aback by your asking this.

 

  • Author

Hi comment.  I'm sorry if I disappointed you  :(  please understand I am not a database expert. I am a printing-company owner who dabbles in getting freelancers to write website code, and I was introduced to FM (I think it was then Filemaker II) in the late 1980's as a way to "manipulate and massage" data to feed into DTP programs like QuarkXPress.

As I only use FMPro when a need arises, I am not attuned to the subtleties of the program, and to answer your 2 points above:  I had followed the installation instructions to manually copy the baseelements.plugin file into the Library on my Mac, and thought it had not installed because (unlike Works360 plugin, which added script steps in ScriptWorkspace) BE didn't appear. BUT IT HAD INSTALLED (as I found when using Filemaker>Preferences).

I have very much valued your help in the past in providing me with chunks of code which enabled me to achieve results that I couldn't figure out for myself, and I hope you'll be able to help me again in the future.

Please forgive me.

Regards,  Philip Caplan

There is no need to apologize. I was simply surprised because you have been a member here for over 15 years and you describe your skill level as intermediate. I try to tailor my responses to the asker and I would not offer the suggestion in my first post to a novice.

 

  • Author

My skill level is "intermediate" because, if it was offered as an option, I would prefer to say "intermediate in what I know, novice in what I don't". But that wasn't a choice!!

:)

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.