|
发表于 2009-2-7 23:15:14
|
显示全部楼层
好长时间不玩AU3了!这位朋友要实例,俺提供一个老的例子!供参考!
Const $NUMBER_OF_ROWS = 1
Const $NUMBER_OF_COLUMNS = 3
$objWord = ObjCreate("Word.Application")
$objWord.Visible = 1
$objDoc = $objWord.Documents.Add()
$objRange = $objDoc.Range()
$objDoc.Tables.Add ($objRange, $NUMBER_OF_ROWS, $NUMBER_OF_COLUMNS)
$objTable = $objDoc.Tables(1)
$objTable.Cell(1, 1).Range.Text = "Service Name"
$objTable.Cell(1, 2).Range.Text = "Display Name"
$objTable.Cell(1, 3).Range.Text = "Service State"
$x = 2
$strComputer = "."
$objWMIService = _
ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_Service")
For $objItem in $colItems
$objTable.ROWS.Add()
$objTable.Cell($x, 1).Range.Text = $objItem.Name
$objTable.Cell($x, 2).Range.Text = $objItem.DisplayName
$objTable.Cell($x, 3).Range.Text = $objItem.State
$x = $x + 1
Next
$objTable.AutoFormat(9) |
|