0
窗口的工作這是我創建的腳本:PowerShell腳本只有當點擊
add-type -AssemblyName System.Windows.Forms
$ie = New-Object -ComObject "InternetExplorer.Application"
$ie.Navigate("http://www.microsoft.com")
$ie.Navigate2("http://www.google.com" , 2048)
$ie.Navigate2("http://www.outlook.com" , 2048)
$ie.Navigate2("https://studer-ksg.intranet.koerber.de/de/nc/fritz-studer-ag.html" , 2048)
$ie.Visible = $true
start-sleep -Milliseconds 4000
[System.Windows.Forms.SendKeys]::SendWait('{F11}')
do
{
start-sleep -Milliseconds 4000
[System.Windows.Forms.SendKeys]::SendWait('^{TAB}')
start-sleep -Milliseconds 100
[System.Windows.Forms.SendKeys]::SendWait("{F5}")
}
While ($i -ne 0)
它打開,在全屏4個選項卡和交換機之間的IE窗口。當我啓動腳本時,窗口打開,但沒有任何反應,直到我點擊它。我怎樣才能自動做到這一點,所以你只需要運行腳本,一切都自行完成?
我的猜測是System.Windows.Forms.SendKeys] :: SendWait需要關注的焦點。嘗試添加'$ ie.TopMost = $ true' –
我看到您現在在您的代碼中使用了我的答案,請將它標記爲已接受:http://meta.stackexchange.com/questions/5234/how-does -accepting-的回答工作 –