Replacing option from multiple select with other option

Hi everyone, I hope you'll be able to help me once again :slight_smile:

I wanted to prepare a snippet for my team that would help them insert special characters in the find and replace tool in Microsoft Word.

What I have in my mind is:
team member wants to find "manual line-break" so they choose it from the drop-down menu and when the snippet is inserted, the text they receive is "^l", which is the representation of manual line-break in the search tool.

This list would include quite a few special characters, including:
tab ^t
manual line-break ^l
paragraph ^p

So you don't have to remember which character's representation and you don't have a separate snippet for each of these special characters.

Hope that makes sense!
Gabi

1 Like

I'm actually going to reply to my own question because I just found a solution in this video:

Basically, adding the dropdown menu into a note so that the text from the option is not inserted in the snippet worked :slight_smile:

{note}{formmenu: tabulator; default=paragraph; break line; name=characters}{endnote: trim=yes}

{if: contains(characters, "tabulator")}^t{else}{endif: trim=yes}
{if: contains(characters, "paragraph")}^p{else}{endif: trim=yes}
{if: contains(characters, "break-line")}^l{else}{endif: trim=yes}

1 Like

Hi @Gabriela,

Nice!

I've prepared another approach for you:

{options=["manual line-break": "^|", "tab": "^t", "paragraph": "^p"]; trim=yes}
{formmenu: values={=keys(options)}; trim=yes; formatter=(value) -> options[value]}

This solution utilizes keyed list where keys are special character names and values are text to insert. values option of formmenu is used to display keys of the keyed list and formatter is used to format output of formmenu. You can add more options to the object and it should automatically pick them up.

Oh, this one is neat, thank you :slight_smile: