1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function obtenir_page_web_sauvegarde_temp
{
param([string]$nompagetemp, [string]$adresse_web)
$code = '$helper = New-Object -comobject WScript.Shell; $helper.AppActivate(''Enregistrer le document HTML'', $true); $helper.SendKeys(''{ENTER}'')'
$ie = new-object -com "InternetExplorer.Application"
$ie.navigate("$adresse_web")
if (Test-Path -path $nompagetemp)
{
Remove-Item -path $nompagetemp -force
}
while ($ie.ReadyState -ne 4) { Start-Sleep -Milliseconds 200}
Start-Process powershell.exe -argument ('-version 2.0 -noprofile -windowstyle hidden -command "{0}"' -f $code)
$ie.ExecWB(4,2,$nompagetemp,[ref]$null)
} |
Partager