smarshall
12 years agoOccasional Contributor
Parameterizing Object Properties
I know this is possible as I have done it years ago but do not remember the syntax in order to accomplish this.
I have an object and want to compare the existing property with the value. The property; however, is variable. How can I call the non-hard coded property variable for comparison? The CheckProperty will accept the property variable; however, I do not desire to log an error if the checkProperty returns false, nor do I desire to wait for the checkProperty to return true.
i.e. Hard coded property
I have an object and want to compare the existing property with the value. The property; however, is variable. How can I call the non-hard coded property variable for comparison? The CheckProperty will accept the property variable; however, I do not desire to log an error if the checkProperty returns false, nor do I desire to wait for the checkProperty to return true.
i.e. Hard coded property
 If pobjItem.contentText <> pObjValue Then
      Call bObjectClick(pobjItem, pFindBy, pObjType, pObjValue, pTagName)
      call bFindNativeWebObjectAndClick(pFindBy, pObjType, pObjValue, pTagName, "", "")
 End if
 
 i.e. desired function with parameterize call to object property.
 
 pobjType = contentText (This Is passed by another function)
 
 If pobjItem.pobjType <> pObjValue Then
     Call bObjectClick
     Call bFindNativeWebObjectandClick
 End if
  
VBScript Example of getting object property (With variable (myPropName) property name):
Sub Main
Set wShell = CreateObject("wScript.Shell")
wShell.Run "notepad"
Set myObj = Sys.Process("Notepad")
Dim myPropName
myPropName = "FullName"
msgbox aqObject.GetPropertyValue(myObj,myPropName),vbSystemModal
End Sub
'This is much easier in JScript :)