#Note This first line is mandatory
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
# Start WinWord (if not already running)
Start-Process -FilePath "excel.exe"
# Wait for WinWord to open and become active
Start-Sleep -Seconds 3
# Activate the WinWord window (adjust the title if necessary)
$wshell = New-Object -ComObject wscript.shell
#$wshell.AppActivate("Document1 - Word") # Or the actual document title
Start-Sleep -Seconds 1
for ($i = 1; $i -le 5; $i++) {
$j = [char](65 + $i)
[System.Windows.Forms.SendKeys]::SendWait("$j")
}
or
for ($test = 0; $test -lt 26; $test++)
{
[char](65 + $test)
}
No comments:
Post a Comment