AnsweredAssumed Answered

clickable partial text field with bold style

Question asked by romax on Dec 10, 2016
Latest reply on Dec 20, 2016 by romax

Hey All, i’m Max and i am new in this forum.

I Have “played” with FM since the times of version 8 but i never got too far into functions and scripts if not easy steps and some pre-made or light modified script. so be patient…



This is the scenario:

I have a database with over 1500 movies and for each record i have a text field called CAST in wich we find first and last name of actors and other stuff  like



Name Surname: RoleName RoleSurname

Name Surname: RoleName RoleSurname

Name Surname: RoleName RoleSurname

Name Surname: RoleName RoleSurname






My goal

obtain a clickable actor occurrence (name+surname) with bold partial formatting of a text field (Cast). By clicking the actor occurrence a search starts finding the records of the actor selected.


my idea was to divide the problems in two


PART1)a first script select the keywords using Get ( ActiveSelectionStart ) and Get ( ActiveSelectionStart ) in a script triggered by the field itself. The script should recognise and select the bold text as key text to be found.


PART2) A second script should format actor occurrence as bold when they matched with same occurrence in another table field containing actors name or (maibe better) just format as bold the first two words after any carriage return




as for the PART1 (selecting script) i found the example of Phil Caulkins  here

Trigger a script by selecting text

and here the example i have studied on called Adentures on Filemaking n°1 by same author

Dropbox - Adventure 1 CVLs.fmp12


In his shared file he uses a script that gave me the idea to follow.. using the get active selection start he found the underlined text inA  text field and uses the selection to compose a URL to open via script.

I changed some parameter so that sensible text is bolded instead of underlined and I used a carriage return instead of a tab (Char 13) as starting point (if I’m not wrong). then i used the variable in a search step instead of an open url. It work but there some…


Part1 PROBLEMS: select script finds both word and not Name+Surname: eg. if an actor name is John Smith, if i click on Smith it finds also Robert Smith and if i click on John i find with same name but not surnamw.

So my question is how can i get name+surname as a unique variable even if i click on single word (name or surname)? i think i must use previous word and next word operators but i can’t understand how.

in this solution i see also another problem which comes out when the actors occurrence has more than two words (e.g. Catherine Zeta Jones).

A solution could be selecting all the words before the symbol “:” which somehow divides what is interesting for a search from what is not.


I made a DEMO PART1 of the script, you can see it here

Dropbox - forum_example.fmp12






as for PART2 i am a bit more far…

I tried the first approach (format as bold matched identical words in another field/table)


Again the idea comes from Phil Caulkins as shown in this thread 


the script is this


Set Variable [ $I; Value:1 ]


       Set Variable [ $Word; Value:$Word + 1 ]

       If [ MiddleWords ( WordHighlighter::Paragraph ; $Word ; 1 ) = WordHighlighter::Word ]

               Set Variable [ $Paragraph;

                                 Value:$Paragraph & TextStyleAdd ( Middle ( WordHighlighter::Paragraph;

                                 $I ; Position ( WordHighlighter::Paragraph ; WordHighlighter::Word ; $I ; 1 ) + Length ( WordHighlighter::Word ) - $I + 1 ) ; Bold ) ]


               Set Variable [ $Paragraph; Value:Let ( word = MiddleWords ( WordHighlighter::Paragraph ; $Word ; 1 ) ; $Paragraph &

                                   Middle ( WordHighlighter::Paragraph; $I ; Position ( WordHighlighter::Paragraph ; word ; $I ; 1 ) + Length ( Word ) - $I + 1 ) ) ]

       End If

       Set Variable [ $I; Value:Let ( word = MiddleWords ( WordHighlighter::Paragraph ; $Word ; 1 ) ;

                           Position ( WordHighlighter::Paragraph ; Word ; $I ; 1 ) + Length ( Word ) ) + 1 ]

       Exit Loop If [ $Word ≥ WordCount ( WordHighlighter::Paragraph ) ]

End Loop

Set Field [ WordHighlighter::Paragraph 2; $Paragraph ]



i have changed the statement [ MiddleWords ( WordHighlighter::Paragraph ; $Word ; 1 ) in [ MiddleWords ( WordHighlighter::Paragraph ; $Word ; 2 ) to get 2 words from the starting point but but can’t make it work because two problems i think.



First, i don’t have a single field for any actor but i have a single field containing many actors and names and i can’t focus how i can match them with multiple words, and second i can’t make it work using 2 words or more: if i set a name John Smith as the word to be matched but when i write something similar like John Smithsonian bold style disappear and i can see only John on second paragraph.

here a test file with matching solution


Dropbox - provecast.fmp12


Maybe also here the solution can come out formatting as bold al the words in the field before the sign ":" but can't find anything i can study on.


so at this point im'asking

how can i format and search all the word in a field which come before the ":" mark?




Any suggestion is warmly accepted, sorry for the long text in here but i wanted to give more infos i could.


Many thanks