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.

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