WinSet
実行制御 | GUI表示 | 演算・変数 | メモリ・DLL操作 | 文字列操作 |
キーボード | マウス | シェル | ウィンドウ | ウィンドウグループ
ステータスバー | コントロール | サウンド | ファイル | INIファイル |
レジストリ | 環境変数 | AutoHotkey | その他 | 設定関係 | オブジェクト
WinSet[編集]
ウィンドウを常に最前面表示状態にしたり、半透明にしたりする。
WinSet, Attribute, Value [, WinTitle, WinText, ExcludeTitle, ExcludeText]
Parameters[編集]
| 引数名 | 説明 |
|---|---|
| Attribute,Value | 下記参照 |
| WinTitle | ウィンドウタイトルなど。 ウィンドウ指定の方法参照。 |
| WinText | ウィンドウに含まれるテキスト |
| ExcludeTitle | 除外タイトル |
| ExcludeText | 除外テキスト |
Attribute, Value[編集]
| Top | ウィンドウを一番手前に移動する。アクティブにはならない。システムの設定によっては動作しない。 |
| Bottom | ウィンドウを他のすべてのウィンドウの後ろに移動する。 |
| AlwaysOnTop ,On|Off|Toggle Topmost ,On|Off|Toggle |
常に最前面表示状態の設定。ToggleはON/OFFを切り替える。 |
| Disable | ウィンドウを操作不可能にする。 |
| Enable | ウィンドウを操作可能にする。 |
| Redraw | ウィンドウを再描画させる。 |
| Style,N ExStyle,N |
ウィンドウのスタイルを設定する。 N に指定する値については、ウィンドウスタイル一覧を参照。 N の前に +をつけると、そのスタイルを既存のスタイルに追加、 -をつけるとスタイルを削除、 ^をつけるとスタイルの有無を反転。ErrorLevelは、正常終了時は 0、適用不可能なスタイルを指定した場合などは 1になる。
|
WinSet, Region [, Options][編集]
ウィンドウの表示領域を変更する。 Optionsを省略した場合、通常表示に戻る。
Optionsには、以下のものを半角スペース区切りで指定する。
ErrorLevelは、正常終了時は 0、適用不可能なスタイルを指定した場合などは 1になる。
| Wn Hm x-y | 幅n 高さm の矩形の範囲を表示する。x,yが矩形の左上の座標(ウィンドウの左上からの相対座標)になる。 負の値も指定可能。(例: W640 H480 10-10 W640 H480 -10--10)
|
| Rw-h Wn Hm x-y | 角の丸い矩形にする。角は幅w 、高さh の楕円になる。(例: R30-30)単に Rとした場合、 R30-30としたことになる。
|
| E Wn Hm x-y | 矩形の代わりに、矩形に接する楕円になる。 |
| x1-y1 x2-y2 x3-y3 ... | 各xn-ynの組を頂点とした多角形の領域を表示する。(例: 0-0 0-30 30-0)100-100 0-100 100-0として|×|型にしたりすることも可能。最大2000組まで指定可能。 |
| Wind x1-y1 x2-y2 x3-y3 ... | Alternatingメソッドの代わりにWindingメソッドを使用する(?) |
ErrorLevelは成功時は 0、ウィンドウが見つからない時は 1、オプションエラーが 2、頂点が2000を超えている時は 3となる。
WinSet, Transparent, N[編集]
ウィンドウを半透明にする。( 2000/XP専用)
N に 0...255 の間で透明度を指定。(0で完全に不可視)
OFFを指定すると、半透明を完全に解除する。(255にしただけでは、半透明の計算が行われるため、パフォーマンスが悪くなる)
Transparent および TransColor に関する制限事項
- Win 9x/NT では効果がない
- タイトルバーと最前面状態(WinSet, AlwaysOnTop)がないウィンドウには効果がない。 GUIウィンドウでは「
Gui -Caption +ToolWindow」とすることで効果を発揮できる。 - 透明化の解除の前に透明度を"255"にすると、黒背景のウィンドウの再描画に問題が生じることがある。 再描画がなされていないようなら、強制再描画の為に
Redrawサブコマンドを使ってみるのもよい。
WinSet, TransColor ,Color [N][編集]
ウィンドウの指定した色の部分だけを透明にする(XP専用)
透明になった部分はクリックできず、下のウィンドウがクリックされる。 Colorには透明にしたい色を色名かRRGGBBの書式で指定。
N に透明度を0...255の値で指定することができる。(例: WinSet, TransColor, EEAA99 150)
ウィンドウの透明色を変更する場合は、一旦Transparent,OFFを実行して透明化を解除する必要がある。
GUIウィンドウで Gui,-Captionを併用する場合は、先に WinSet,TransColorを実行しておく必要がある。
Remarks[編集]
各サブコマンドの項で特に説明のない限り、ErrorLevel は変化しない。
Related[編集]
WinGet, WinHide, WinSetTitle, WinMove, WinActivate
Example(s)[編集]
ウィンドウを少しだけ透過させる。
WinSet, Transparent, 200, 無題 - メモ帳
ウィンドウの白い部分を透過させる。
WinSet, TransColor, White, 無題 - メモ帳
電卓のウィンドウで、常に最前面をトグル切り替えする。
WinSet, AlwaysOnTop, toggle, 電卓
; Longer Example:; Here are some hotkeys that demonstrate the effects of "Transparent" and; "TransColor". NOTE: If you press one of the hotkeys while the mouse cursor; is hovering over a pixel that is invisible as a result of TransColor, the window; visible beneath that pixel will be acted upon instead! Also, Win+G will; have an effect only on Windows XP because retrieval of transparency settings; is not supported by Windows 2000:#t::; Press Win+T to make the color under the mouse cursor invisible.MouseGetPos, MouseX, MouseY, MouseWin PixelGetColor, MouseRGB, %MouseX%, %MouseY%, RGB; In seems necessary to turn off any existing transparency first:WinSet, TransColor, Off, ahk_id %MouseWin% WinSet, TransColor, %MouseRGB% 220, ahk_id %MouseWin% Return #o::; Press Win+O to turn off transparency for the window under the mouse.MouseGetPos,,, MouseWin WinSet, TransColor, Off, ahk_id %MouseWin% Return #g::; Press Win+G to show the current settings of the window under the mouse.MouseGetPos,,, MouseWin WinGet, Transparent, Transparent, ahk_id %MouseWin% WinGet, TransColor, TransColor, ahk_id %MouseWin% ToolTip Translucency:`t%Transparent%`nTransColor:`t%TransColor% Return
; Here is a region with a more complex area. It creates a see-through rectangular hole inside a window.
; There are two rectangles specified below: an outer and an inner. Each rectangle consists of 5 pairs
; of X/Y coordinates because the first pair is repeated at the end to "close off" each rectangle.
WinSet, Region, 0-0 300-0 300-300 0-300 0-0 100-100 200-100 200-200 100-200 100-100, WinTitle