0
我的腳本即將完成。它打開IE並在標籤之間切換。它的一半時間工作,它也進入全屏模式。問題是,如果我再次執行它,它已經被設置爲全屏,但它執行F11,因此它停止全屏模式。Powershell腳本即使已經全屏,也會按F11
[void][System.Reflection.Assembly]::LoadWithPartialName(
"Microsoft.VisualBasic")
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 1000
$IEProcess = Get-Process | Where { $_.MainWindowHandle -eq $ie.HWND }
[Microsoft.VisualBasic.Interaction]::AppActivate($IEProcess.Id)
if($ie.fullscreen){
}else{
start-sleep -Milliseconds 1000
[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)
我該如何讓它只按F11,如果它還沒有在全屏時啓動腳本?
預先感謝您
我lol'ed,我不知道這種方法,也許他沒有任何 – 4c74356b41
可悲的是切換標籤似乎有點複雜,涉及到IE進程自己窗口的跟蹤。 – Joey
我在早期版本中使用過,但它不起作用,因爲IE以某種方式凍結。我甚至無法關閉它,除非我使用taskmanager ... –