Word Processing Functions in FileMaker using Buttons and Scripts


I realize that I have very recently covered this topic in a previous post, but I kept working on the file for my own purposes and thought I would add a new post specifically detailing this version and how to add these features to your own database. The scripts are all database and field independent so it is very simply copy and paste to add these features to your own solution.

Sloper Data also has a nice demo of using the Quill Javascript app within FileMaker 19. If you aren’t using FM19 yet, the demo file here will work just fine, probably even a number of versions (I want to say FM 14 perhaps) back as there is no fancy new stuff in the scripts.

Download Demo File

undefined

FileMaker Already has a Formatting Bar
Why do we need to do this when FileMaker already has a Formatting Bar? Good question.

undefined

Formatting Bar displayed
Sometimes you need more functions than what are being offered by the default setting or your users don’t see the “Show Formatting Bar” option in the menus and you want to put it up front.

No Script Step for Displaying the Formatting Bar
Why Claris? Why? Strangely FileMaker does not seem to have a way to script the display of the formatting bar. So my solution was to recreate some of these functions with scripts and buttons.

Demo File with Word Processing Buttons to format a Text Field
I’ve created a Demo file here which you can download and add this functionality to your solution.

It is relatively straightforward to add these functions to your solution. Download the Demo File and do the following in this order:

• Copy the scripts in the folder
• Copy the Buttons onto the layout you wish to use formatting on.

If you copy the scripts after the buttons, you will have to go through and reassign the scripts to the buttons, so keep it simple and copy scripts first, buttons second.

1) Copy the Script Folder to your solution
Select the Text Formatting Scripts folder and Copy—Command (Mac) or Control (Windows) C. Go to your FileMaker database and in the Script Workspace Paste the folder (Command or Control V)

2) Copy the Buttons — Paste into your database
Copy the buttons from the Demo File and Paste them onto the layout you plan to use them on. Position them above the desired field.

Format Text – Bold|Italic etc – Expand this Script
If you require additional Style formatting options, this is the script to add to. I have covered the Styles I need:

•Plain
•Bold
•Italic
•Underline
•HighlightYellow

But there are others offered by FileMaker:

•Condense
•Extend
•Strikethrough
•SmallCaps
•Superscript
•Subscript
•Uppercase
•Lowercase
•Titlecase
•WordUnderline
•DoubleUnderline
•AllStyles (all available styles)

Claris FileMaker Help

To add more Styles to your solution, simply duplicate one of the formatting buttons (Bold is a good one to use), give it a nice recognizable icon, make sure it is still assigned to the script “Format Text – Bold|Italic|Underline|strikethrough|Yellow” and then simply specify the Style in the parameter of the button.

For example, instead of ‘Bold’, enter ‘Condense’ or whichever format you require.

Bullet Points
If you go into this script, you will see I have left room for “numbers” option. If anyone is inspired to add a numbers option, send it to me and I can add it to the demo file. It is not something I required in my solution, so I didn’t build it. Also it seemed complicated to figure out how to remove the numbers once they are inserted. With the bullet characters, I just Substitute them out if they are already there.

Format by Style
This script could be edited and enhanced depending on your needs. You could add specialized fonts etc here if required.

Modifying a Style
Go into each Heading and edit the parameters of the Text Style Add. You could also assign fonts here if needed.

Increase or Decrease the Font Size
This one is kind of interesting. I could not see a way in FileMaker to determine the font size of a text selection. Then I saw a Custom Function on briandunning.com that returns the font size using the GetAsCSS function. (I saw another Custom Function that used GetAsSVG for similar effect, but did not try this method). I also use this approach to toggle the Bold, Italic, Underline etc formatting on or off. For some reason the HighlightYellow is not toggling. Click on the ‘Normal’ button to clear the Yellow.

Show Ruler
If your cursor is in the text field, Show Ruler will display a text ruler to which you can add tabs and indents to your text.

11 Responses to “Word Processing Functions in FileMaker using Buttons and Scripts”

  1. Fantastic script, thanks so much for creating this. The only downside is that it’s not possible in Filemaker to export rtf formate text, so exported text files will be normal. Unless, of course, you have a solution for this 🙂

    thanks!

    best wishes,
    André

  2. Great script, thanks so much for making this! The only problem in Filemaker however, is that it cannot export rtf files, so after exporting the .txt file, all the formatting will be gone.

    Any ideas how to fix this natively without using 3rd party plugins?

    thanks and best wishes from Sweden!

    André

  3. Hi Douglas, I expected that by choosing “Normal”, the selected text style would go back to the settings as set in the Inspector panel, but that is not the case. It looks like it’s applying the text format from the start of the selection to the rest of the selection.

    How would I change the Normal script step so the selected text goes back to the Inspector/Appearance settings?

  4. Hi Douglas. While the Bold, Italic and Underlined buttons work as a toggle, the Yellow and Strikethrough do apply the Style but do not remove it. Is this a bug?

    • By turning on a Custom Dialog Box to see what was in the $TheCSS variable, I was able to see that, yellow and strikethrough are represented differently in the CSS. My script was looking for the terms ‘strikethrough’ and ‘yellow’. I have put in some exceptions to look for ‘line-through’ and ‘#FFFF00’ instead. I will upload a new demo file with some modifications to fix this shortly.