2016年4月8日金曜日

PowerShell IE起動 ~ アクティブ ~ スクリーンショット

IEを起動して、そのスクリーンショットを取る。


Set-Variable uri41 'https://www.google.co.jp'

    $ie=new-object -com InternetExplorer.Application

    $ie.visible=$true


    $ie.navigate("$uri41")


# IEをアクティブにする

add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms

$b = (Get-Process | Where-Object {$_.MainWindowTitle -like "*Internet
Explorer*"}).id

start-sleep -Milliseconds 500
[Microsoft.VisualBasic.Interaction]::AppActivate($b)


# IE画面のスクリーンキャプチャ
$bitmap = new-object Drawing.Bitmap($ie.Width, $ie.Height)
$graphics = [Drawing.Graphics]::FromImage($bitmap)
$graphics.CopyFromScreen($ie.Left, $ie.Top, 0, 0, $bitmap.Size)
$format = "jpeg"
$filename = "D:\google.jpg"
$bitmap.Save($filename, $format)


本日の河上選手:児島4日目
  9R 3号艇 3コース進入 5着