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.

53 lines
2.0 KiB

  1. //***************************************************************************
  2. //This script tests the manipulation of property values, in the case that the
  3. //property is a not an array type
  4. //***************************************************************************
  5. //var locator = new ActiveXObject ("Wbem.Locator");
  6. //var service = locator.ConnectServer (".", "root/default");
  7. var service = GetObject("winmgmts:root/default");
  8. var Class = service.Get();
  9. Class.Path_.Class = "PROP00";
  10. var Property = Class.Properties_.Add ("p1", 19);
  11. Property.Value = 25;
  12. WScript.Echo ("The initial value of p1 is", Class.Properties_("p1"));
  13. //****************************************
  14. //First pass of tests works on non-dot API
  15. //****************************************
  16. WScript.Echo ("");
  17. WScript.Echo ("PASS 1 - Use Non-Dot Notation");
  18. WScript.Echo ("");
  19. //Verify we can report the value of an element of the property value
  20. var v = Class.Properties_("p1");
  21. WScript.Echo ("By indirection p1 has value:",v);
  22. //Verify we can report the value directly
  23. WScript.Echo ("By direct access p1 has value:", Class.Properties_("p1"));
  24. //Verify we can set the value of a single property value element
  25. Class.Properties_("p1") = 234
  26. WScript.Echo ("After direct assignment p1 has value:", Class.Properties_("p1"));
  27. //****************************************
  28. //Second pass of tests works on dot API
  29. //****************************************
  30. WScript.Echo ("");
  31. WScript.Echo ("PASS 2 - Use Dot Notation");
  32. WScript.Echo ("");
  33. //Verify we can report the value of a property using the "dot" notation
  34. WScript.Echo ("By direct access p1 has value:", Class.p1);
  35. //Verify we can report the value of a property using the "dot" notation
  36. var v = Class.p1;
  37. WScript.Echo ("By indirect access p1 has value:", v);
  38. //Verify we can set the value using dot notation
  39. Class.p1 = -1
  40. WScript.Echo ("By direct access via the dot notation p1 has been set to", Class.p1);
  41. Class.Put_ ();