指定したURLリストからクローム起動して、スクリーンショットを取っていくPGMです。
起動時には他のクロームが起動していないで動作させるようにします.
- 参考サイト
ソースコード
2.chromeSousa.ps1
# スクリーンショットをとるリンクのリスト
$linkList = @("http://hooktail.sub.jp/mathInPhys/intro/",
"http://hooktail.sub.jp/mathInPhys/kainokoshiki/"
);
for($i=0; $i -lt $linkList.Count; $i++ ){
$url = $linkList[$i];
$ps = Start-Process chrome.exe -ArgumentList $url -PassThru
#クローム起動するまで待ち
Start-Sleep -Seconds 3
[System.Windows.Forms.SendKeys]::SendWait(“{F12}”);
#デバックモードになるまで待ち
Start-Sleep -Second 5
#Ctrl+Shift+p
[System.Windows.Forms.SendKeys]::SendWait("^+p")
[System.Windows.Forms.SendKeys]::SendWait("full")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
#スクリーンショット取り終わるまで待ち
Start-Sleep -Second 5
Stop-Process -Id $ps.Id
}