Retrieving text from widget by variable name

I am trying to retrieve text from a widget where the widget name equals to value of a global variable.
That is, if there are 4 rectangle widgets (Wid1, Wid2, Wid3 and Wid4) with some text in each of them, and the value of a global variable “WidName” is set to any of the 4 widget names then clicking on an action button would retrieve text from that widget whose name matches the value of “WidName”.
[[WidName.text]] doesn’t seem to work.

As far as I know, this requires a “brute force” approach in Axure. There aren’t arrays of widgets which would allow you to access widget properties like this. Neither would a global variable have another widget’s text as its own property (unless the global variable’s only property (which is text) is set to that widget’s text property.)

Two approaches demonstrated in this rp file:
TextFromWidget.rp (75.7 KB)

Home: The OnClick of your action button would has four conditions. "If value of WidName equals “Wid1” set to text on Wid1, Else if value of WidName equals “Wid2” … and so forth.

Page 1: The four widgets are loaded with a “function” that “returns” their text. You can employ an otherwise unused event, such as OnMove or OnRotate, for example “Move Wid1 by (0,0)” --the result is the widget is not actually moved but it triggers its OnMove event so your “function” is executed. The OnClick of your action button just moves all your widgets. When a widget is moved it tests it’s name against the value of WidName and if it matches, it sets the text value of another widget (or whatever you need to do with that text.) This approach is less straightforward but allows you to more easily add more widgets.