Forum Discussion

murugans1011's avatar
murugans1011
Regular Contributor
11 years ago

Vbscript Object reference

I  m using vbscript need do object reference



function A



Set Vobject= sys.Process("process").vbobject("object")   //'"Vobject" variable contains

                                                                                                         reference to an object

End function



function B



{   execute "A"

     Vobject.click  // 'need to use object reference here how to do that

                             // 'getting object required error

}

3 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi,



    Either (VBScript):



    Dim Vobject



    Function A

      Set Vobject= sys.Process("process").vbobject("object")   //'"Vobject" variable contains reference to an object

    End Function



    Function B

      Call A

      Vobject.click  'need to use object reference here how to do that

                            'getting object required error

    End Function



    or



    Function A

      Set A = sys.Process("process").vbobject("object")

    End Function



    Function B

      Set Vobject = A()

      Vobject.click

    End Function

  • murugans1011's avatar
    murugans1011
    Regular Contributor
    hi thanks the method works fine. is there any alternative method do this?like scripting



    dictionary







    the tested app contains lots of objects . i have used findall method to find all objects in tested app.the findall method returns array of objects,



    • Set RefVariable=process.findall(propNames,propValues,10)


    it returns like



    • RefVariable(0)=object1


    • RefVariable(1)=object2




    how it can be initialized and how to give reference to other functions. is everything need to be initialized separately  before executing the fucntion by assigning global scope?(Plz see the attached screenshot)   and i havent used namemapping feature