マウスポインタ
■処理フロー
 「コントロールパネル」を開く。
 ウィンドウ左上から右下にマウスを移動する。


■スクリプト
Import-Module C:\UIAutomation\UIAutomation.0.8.7B3.NET35\UIAutomation.dll
[UIAutomation.Preferences]::Highlight=$false

#「コントロールパネル」を開く。
Start-Process C:\Windows\System32\control.exe

#「コントロールパネル」ウィンドウを取得する。
$ctlwndw = Get-UiaWindow -Name 'すべてのコントロール パネル項目'

#ウインドウの座標範囲を取得する。
$left = $ctlwndw.Current.BoundingRectangle.Left
$top = $ctlwndw.Current.BoundingRectangle.Top
$right = $ctlwndw.Current.BoundingRectangle.Right
$bottom = $ctlwndw.Current.BoundingRectangle.Bottom

#ウィンドウ左上から右下にマウスを移動する。
add-type -AssemblyName System.Windows.Forms
$x=$left
$y=$top
while(($x -le $right) -and ($y -le $bottom)){
    [System.Windows.Forms.Cursor]::Position = new-object System.Drawing.Point($x, $y)
    Start-Sleep -S 1
    $x=$x+100
    $y=$y+100
}

コメント

このブログにコメントするにはログインが必要です。