我编写了这个简单的脚本,以便连接到Word 2010事件。注册工作正常,但我没有收到任何活动。
$w = new-object -com "word.application"
$w.visible = $true
$ds = $w.documents
$d = $ds.add()
$action = {
Write-Host "Changed"
}
Register-ObjectEvent -InputObject $w -EventName DocumentChange -Action $action