Setting Text choosing from different Variables to FrontField Browser

Updated
Set Variable to FrontBrowser.kmmacros (15.0 KB)

Image: It shows the variables has different contents

Names of Variables that contain Text

Hi Guys, I have to set the text to the front browser field choosing from different variables, my solution is to use a switch.

My current macro works like this.
The variables are named
m1, m2, m3 up to m100 or more each of them contains different texts or numbers. and if I called 3 in switch it should call variable m3.

But my problem is, the variables can be numbered up to 100 so it will be very long writing in a single action.

Anyway to shorten this action? using a different method like For Each? I'm not familiar in For Each Action if you can help me it will contribute to my learning for this action as well. Or using a script.

One solution to this involves neither For Each nor a switch, but an admittedly non-intuitive filter action called Filter for Value of Named Variable:

Set Front Browser to Variable.kmmacros (2.0 KB) image

How it works is, you set the LocalBrowserField variable to the name of the variable you want to use, then use this filter action to replace the name of the variable with its value. It may be difficult to grasp until you see it in action, so give this a try and see if it doesn't do the trick.

1 Like

Thank you so much gglick, this is new for me, and it works. :smiley:

1 Like