WinMove

提供: AutoHotkey Wiki
移動: 案内検索

実行制御 | GUI表示 | 演算・変数 | メモリ・DLL操作 | 文字列操作 | キーボード | マウス | シェル | ウィンドウ | ウィンドウグループ
ステータスバー | コントロール | サウンド | ファイル | INIファイル | レジストリ | 環境変数 | AutoHotkey | その他 | 設定関係 | オブジェクト

WinMove[編集]

ウィンドウの位置やサイズを変更する。

WinMove, X, Y 
WinMove, WinTitle, WinText, X, Y [, Width, Height, ExcludeTitle, ExcludeText]

Parameters[編集]

引数名 説明
WinTitle ウィンドウタイトルなど。
ウィンドウ指定の方法参照。
WinText ウィンドウに含まれるテキスト
X, Y ウィンドウの新しい水平座標と垂直座標を指定。
数値の指定には を用いることが可能。
Width, Height ウィンドウの新しい幅と高さを指定。省略時は変更なし。
数値の指定には を用いることが可能。
ExcludeTitle 除外タイトル
ExcludeText 除外テキスト

Remarks[編集]

2つの整数を引き数とした場合、LastFoundWindowをその位置に移動する。

WidthやHeightに一定値より小さいサイズを指定した場合、タイトルバーのアイコンとボタンなどが表示される最小限のサイズになる。

XやYには、ウィンドウがスクリーンから消えてしまうような値も指定可能。

最小化されているウィンドウは移動できない。
DetectHiddenWindowsがOnなら、非表示のウィンドウも移動できる。

Related[編集]

ControlMove, WinGetPos, WinHide, WinMinimize, WinMaximize, WinSet

Example(s)[編集]

Run, calc.exe
WinWait, Calculator
WinMove, 0, 0			; Move the window found by WinWait.
SplashTextOn, 400, 300, Clipboard, The Clipboard contains:`n%Clipboard%
WinMove, Clipboard, , 0, 0	; Move the splash window to the top left corner. 
MsgBox, Press OK to dismiss the SplashText
SplashTextOff
; The following function centers the specified window on the screen:
CenterWindow(WinTitle)
{
  WinGetPos,,, Width, Height, %WinTitle%
  WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)
}