home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / wsh.cab / chart.js next >
Text File  |  1997-09-16  |  2KB  |  65 lines

  1. // Windows Script Host Sample Script
  2. //
  3. // ------------------------------------------------------------------------
  4. //               Copyright (C) 1996-1997 Microsoft Corporation
  5. //
  6. // You have a royalty-free right to use, modify, reproduce and distribute
  7. // the Sample Application Files (and/or any modified version) in any way
  8. // you find useful, provided that you agree that Microsoft has no warranty,
  9. // obligations or liability for any Sample Application Files.
  10. // ------------------------------------------------------------------------
  11.  
  12. // This sample demonstrates how to access Microsoft Excel using the Windows Scripting Host.
  13.  
  14. var vbOKCancel = 1;
  15. var vbInformation = 64;
  16. var vbCancel = 2;
  17.  
  18. var L_Welcome_MsgBox_Message_Text    = "This script demonstrates how to access Excel using the Windows Scripting Host.";
  19. var L_Welcome_MsgBox_Title_Text      = "Windows Scripting Host Sample";
  20. Welcome();
  21.     
  22. //////////////////////////////////////////////////////////////////////////////////
  23. //
  24. // Excel Sample
  25. //
  26.  
  27. var objXL;
  28.  
  29. objXL = WScript.CreateObject("Excel.Application");
  30. objXL.Workbooks.Add;
  31. objXL.Cells(1,1).Value = 5;
  32. objXL.Cells(1,2).Value = 10;
  33. objXL.Cells(1,3).Value = 15
  34. objXL.Range("A1:C1").Select;
  35.  
  36. var objXLchart = objXL.Charts.Add();
  37. objXL.Visible = true;
  38. objXLchart.Type = -4100;
  39.  
  40. var intRotate;
  41. for(intRotate = 5; intRotate <= 180; intRotate += 5) {
  42.     objXLchart.Rotation = intRotate;
  43. }
  44.  
  45. for (intRotate = 175; intRotate >= 0; intRotate -= 5) {
  46.     objXLchart.Rotation = intRotate;
  47. }
  48.  
  49. //////////////////////////////////////////////////////////////////////////////////
  50. //
  51. // Welcome
  52. //
  53. function Welcome() {
  54.     var WSHShell = WScript.CreateObject("WScript.Shell");
  55.     var intDoIt;
  56.  
  57.     intDoIt =  WSHShell.Popup(L_Welcome_MsgBox_Message_Text,
  58.                               0,
  59.                               L_Welcome_MsgBox_Title_Text,
  60.                               vbOKCancel + vbInformation );
  61.     if (intDoIt == vbCancel) {
  62.         WScript.Quit();
  63.     }
  64. }
  65.