Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.8 KiB

  1. '***************************************************************************
  2. 'This script tests the manipulation of context values, in the case that the
  3. 'context value is an array type
  4. '***************************************************************************
  5. Set Context = CreateObject("WbemScripting.SWbemNamedValueSet")
  6. On Error Resume Next
  7. Context.Add "n1", Array (1, 2, 3)
  8. str = "The initial value of n1 is {"
  9. for x=LBound(Context("n1")) to UBound(Context("n1"))
  10. str = str & Context("n1")(x)
  11. if x <> UBound(Context("n1")) Then
  12. str = str & ", "
  13. End if
  14. next
  15. str = str & "}"
  16. WScript.Echo str
  17. WScript.Echo ""
  18. 'Verify we can report the value of an element of the context value
  19. v = Context("n1")
  20. WScript.Echo "By indirection the first element of n1 has value:",v(0)
  21. 'Verify we can report the value directly
  22. WScript.Echo "By direct access the first element of n1 has value:", Context("n1")(0)
  23. 'Verify we can set the value of a single named value element
  24. Context("n1")(1) = 11
  25. WScript.Echo "After direct assignment the first element of n1 has value:", Context("n1")(1)
  26. 'Verify we can set the value of a single named value element
  27. Set v = Context("n1")
  28. v(1) = 345
  29. WScript.Echo "After indirect assignment the first element of n1 has value:", Context("n1")(1)
  30. 'Verify we can set the value of an entire context value
  31. Context("n1") = Array (5, 34, 178871)
  32. WScript.Echo "After direct array assignment the first element of n1 has value:", Context("n1")(1)
  33. str = "After direct assignment the entire value of n1 is {"
  34. for x=LBound(Context("n1")) to UBound(Context("n1"))
  35. str = str & Context("n1")(x)
  36. if x <> UBound(Context("n1")) Then
  37. str = str & ", "
  38. End if
  39. next
  40. str = str & "}"
  41. WScript.Echo str
  42. if Err <> 0 Then
  43. WScript.Echo Err.Description
  44. Err.Clear
  45. End if