Hi Bill,
No problem. Here is the VBScript version of the script - please let me know if it works for you.
[VBScript]
...
Dim obj, storedObj
Set obj = ' Obtain the target application object
Set storedObj = Objects.StoredObject("MyStoredObj")
Call Log.Message(CompareObjects(obj, storedObj, ""))
...
Function CompareObjects(obj, storedObj, excludedProps)
Dim prop, child, storedChild, ret, errorStr, i
ret = True
errorStr = ""
For i = 0 To storedObj.PropertyCount - 1
Set prop = storedObj.Properties(i)
If InStr(1, excludedProps, prop.Name) <= 0 Then
if Not IsSupported(obj, prop.Name) Then
ret = False
errorStr = errorStr & "Object doesn't support the '" + prop.Name + "' property" & vbCrLf
End If
If Not CompareStrings(BuiltIn.VarToStr(BuiltIn.GetValue(obj, prop.Name)), BuiltIn.VarToStr(prop.Value)) Then
ret = False
errorStr = errorStr & "Property value mismatch (" & prop.Name & "):" & vbCrLf & "Stored value = " & BuiltIn.VarToStr(prop.Value) & vbCrLf & "Actual value = " & BuiltIn.VarToStr(BuiltIn.GetValue(obj, prop.Name)) & vbCrLf
End If
End If
Next
For i = 0 To storedObj.ChildCount - 1
Set storedChild = storedObj.Children(i)
Set child = obj.FindChild("Name", storedChild.Name)
if Not child Then ret = False
ret = CompareObjects(child, storedChild, excludedProps)
Next
If Not ret Then Call Log.Error("Objects are not identical", errorStr)
CompareObjects = ret
End Function
Function CompareStrings(str, pattern)
pattern = StringReplace(pattern, "\", "\\", 1)
pattern = StringReplace(pattern, ".", "\.", 1)
pattern = StringReplace(pattern, "(", "\(", 1)
pattern = StringReplace(pattern, ")", "\)", 1)
pattern = StringReplace(pattern, "[", "\[", 1)
pattern = StringReplace(pattern, "]", "\]", 1)
pattern = StringReplace(pattern, "*", ".*", 1)
pattern = StringReplace(pattern, "?", ".?", 1)
Dim re
Set re = New RegExp
re.Pattern = "^" & pattern & "$"
CompareStrings = re.test(str)
End Function