Forum Discussion

ioioio's avatar
ioioio
Occasional Contributor
8 years ago
Solved

Construct a object if I know the object name

Hi,   I have the following call:   Call Aliases.browser.page.formForm0.radiobutton1YearSubscription.ClickButton where radiobutton1YearSubscription is a radio button in a form. In the same form i...
  • AlexKaras's avatar
    8 years ago

    Hi,

     

    All scripting languages have an equivalent of the evaluate() or eval() function that accepts a string, executes it as code and returns a result.

    The code for your case will be like that (VBScript pseudocode that should be adjusted to match the language used in your project):

    ...
    BTNy = "radiobutton1YearSubscription"
    ...
    
    strObjAlias = aqString.Format("Aliases.browser.page.formForm0.%s", BTNy)
    Set oObj = Evaluate(strObjAlias)
    If (oObj.Exists) Then
      Call oObj.ClickButton()
    Else
      ...
    End If