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.

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: