OLE/COM Adapter

The OLE/COM adapter of Pnuts provides an easy way to access OLE/COM server of Windows like Visual Basic. The OLE/COM adapter consists of classes and scripts in ${PNUTS}/examples/ole directory. Note that this feature requires com.ms.com package of MS JVM.

The following script shows how its usage is similar to Visual Basic's.

require("vbscript")

objXL = CreateObject("Excel.Application")
objXL.Workbooks.Add()
objXL.Cells(1, 1).Value = 5
objXL.Cells(1, 2).Value = 10
objXL.Cells(1, 3).Value = 15
objXL.Range("A1", "C1").Select()

objXLchart = objXL.Charts.Add()
objXL.Visible = true
objXLchart.Type = -4100

for (i = 5; i < 180; i += 5){
   objXLchart.Rotation = i
}

for (i = 175; i >= 0; i -= 5){
   objXLchart.Rotation = i
}

Back