
On a FileMaker themed Facebook group, someone asked:
In a word processor you can highlight text and then hit a button to change formatting, line BOLD, UNDERLINE, COLOR…etc. In Filemaker you use the format drop down menus, but does anyone know how to make a button to change the format of the currently highlighted text?
I knew I had done this before but struggled to find the solution where I had done this, so I am making a note here for future reference to myself and others.
Make a set of buttons calling a script.
Give each button the script parameter of the desired formatting option, such as ‘bold’, ‘italic’ etc. Then make/call a script called something like ‘Format Text’.
2020-05-23 Updated script to be field independent, based on suggestions from the person who posed the question in the first place.

Format Text
If [ Get(ActiveSelectionSize)=0 ]#skip action – nothing selected.
Else
#format text using the script parameter.
Set Variable [ $TheText; Value:TextStyleAdd ( Middle ( Get(ActiveFieldContents); Get(ActiveSelectionStart) ; Get (ActiveSelectionSize )) ; Get(ScriptParameter) ) ]
Insert Calculated Result [ $TheText ]
End If
Once you have the script and buttons in place, you should be able to select text in a field and then tap the buttons to quickly add formatting to your FileMaker database text.
You will of course need to replace ‘FM_Word Processor::Text with the field name you want this script to work on. I tried to make it more portable by using ‘Self’ instead of a field name, but FileMaker did not seem to like this level of abstraction.

Full list of formatting options are here: https://fmhelp.filemaker.com/help/14/fmp/en/html/func_ref1.32.284.html#1077883
•Plain
•Bold
•Italic
•Underline
•HighlightYellow
•Condense
•Extend
•Strikethrough
•SmallCaps
•Superscript
•Subscript
•Uppercase
•Lowercase
•Titlecase
•WordUnderline
•DoubleUnderline
Trackbacks/Pingbacks
[…] 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 […]