WinGet

지정된 창의 유일한 ID, 프로세스 ID, 프로세스 이름, 또는 그의 콘트롤 목록을 열람합니다. 또 지정된 기준에 부합하는 모든 창의 목록을 열람할 수도 있습니다.

WinGet, OutputVar , SubCommand, WinTitle, WinText, ExcludeTitle, ExcludeText

매개변수

OutputVar
The name of the output variable in which to store the result of SubCommand.
SubCommand
The operation to perform, which if blank defaults to the ID sub-command. See Sub-commands.
WinTitle
목표 창을 식별하는 창 제목 또는 다른 기준. WinTitle 참조.
WinText
존재하면, 이 매개변수는 목표 창 텍스트의 부문자열입니다 (동봉된 Window Spy 유틸리티에 노출됨). 숨은 텍스트는 DetectHiddenText가 켜져 있어야 탐지됩니다.
ExcludeTitle
제목에 이 값이 있는 창은 무시합니다.
ExcludeText
텍스트에 이 값이 있는 창은 무시합니다.

부-명령어

For SubCommand, specify one of the following:

ID

창의 유일 ID 번호을 열람합니다.

WinGet, OutputVar, ID , WinTitle, WinText, ExcludeTitle, ExcludeText

Also known as the window handle (HWND). 부합하는 창이 없으면, OutputVar는 비워집니다. 함수 WinExist()WinActive()도 창의 ID를 열람하는 데 사용할 수 있습니다; 예를 들어, WinExist("A")는 활성 창의 ID를 얻는 가장 빠른 방법입니다. 콘트롤의 HWND를 발견하려면 (Post/SendMessage 또는 DllCall에 사용할 목적으로), ControlGet Hwnd 또는 MouseGetPos를 사용하십시오.

IDLast

Retrieves the unique ID number of the last/bottommost window if there is more than one match.

WinGet, OutputVar, IDLast , WinTitle, WinText, ExcludeTitle, ExcludeText

Also known as the window handle (HWND). 부합하는 창이 없으면, OutputVar는 비워집니다. If there is only one match, it performs identically to the ID sub-command. 이 개념은 WinActivateBottom이 사용하는 개념과 비슷합니다.

PID

Retrieves the Process ID number of a window.

WinGet, OutputVar, PID , WinTitle, WinText, ExcludeTitle, ExcludeText

부합하는 창이 없으면, OutputVar는 비워집니다.

ProcessName

창을 소유한 프로세스의 이름을 열람합니다.

WinGet, OutputVar, ProcessName , WinTitle, WinText, ExcludeTitle, ExcludeText

For example, this would be "notepad.exe". 부합하는 창이 없으면, OutputVar는 비워집니다.

ProcessPath [v1.1.01+]

Retrieves the full path and name of the process that owns a window.

WinGet, OutputVar, ProcessPath , WinTitle, WinText, ExcludeTitle, ExcludeText

For example, this would be "C:\Windows\System32\notepad.exe". 부합하는 창이 없으면, OutputVar는 비워집니다.

Count

Retrieves the number of existing windows that match the title/text parameters.

WinGet, OutputVar, Count , WinTitle, WinText, ExcludeTitle, ExcludeText

If there are no matching windows, OutputVar is set to zero. 시스템의 모든 창을 열람하려면, 네 개의 매개변수를 모두 생략하십시오. 숨은 창은 DetectHiddenWindows이 켜져 있을 때만 탐지됩니다.

List

Retrieves the unique ID numbers of all existing windows that match the title/text parameters.

WinGet, OutputVar, List , WinTitle, WinText, ExcludeTitle, ExcludeText

To retrieve all windows on the entire system, omit all four title/text parameters. (전체 시스템의 모든 창을 열람하려면, 네 개의 제목/텍스트 매개변수를 모두 생략하십시오). 각 ID 번호는 OutputVar의 이름으로 시작하는 변수에 저장됩니다 (의사-배열을 형성합니다). 반면에 OutputVar 자체에는 열람된 항목의 개수가 설정됩니다 (없으면 0입니다). 예를 들어, OutputVar가 MyArray이고 부합한 창이 두 개 발견되었다면, MyArray1은 첫 번째 창의 ID가 설정되고, MyArray2는 두 번째 창의 ID에 설정됩니다. 창은 (바탕화면에 어떻게 쌓여 있는가에 맞추어) 위에서 아래로 열람됩니다. 숨은 창은 DetectHiddenWindows이 켜져 있을 때만 탐지됩니다. 함수 안에서, 지역적이 아니라 전역적 의사-배열을 생성하려면, 이 명령어를 사용하기 전에 먼저 MyArray를 전역 변수로 선언하십시오 (전역-간주 함수에 대하여 그 반대도 마찬가지입니다). 그렇지만, 흔한 혼란의 근원 때문에 종종 집합에서 각 변수를 따로 선언할 필요가 있는 경우도 있습니다.

MinMax

창에 대하여 최소/최대 상태를 열람합니다.

WinGet, OutputVar, MinMax , WinTitle, WinText, ExcludeTitle, ExcludeText

부합하는 창이 없으면 OutputVar는 비워집니다; 그렇지 않으면 다음 숫자 중 하나가 설정됩니다:

ControlList

Retrieves the control name for each control in a window.

WinGet, OutputVar, ControlList , WinTitle, WinText, ExcludeTitle, ExcludeText

부합하는 창이 존재하지 않거나 창에 콘트롤이 없으면, OutputVar는 비워집니다. 그렇지 않으면, Window Spy에 보여지듯이, 각 콘트롤 이름은 그의 클래스 이름과 바로 다음에 연속 번호 (ClassNN)로 구성됩니다.

마지막 항목을 제외하고 각 항목은 라인피드로 끝납니다 (`n). To examine the individual control names one by one, use a parsing loop as shown in example #3 below.

Controls are sorted according to their Z-order, which is usually the same order as the navigation order via Tab if the window supports tabbing.

ControlListHwnd [v1.0.43.06+]

Retrieves the unique ID number for each control in a window.

WinGet, OutputVar, ControlListHwnd , WinTitle, WinText, ExcludeTitle, ExcludeText

부합하는 창이 존재하지 않거나 창에 콘트롤이 없으면, OutputVar는 비워집니다. Otherwise, each unique ID is the window handle (HWND) of the control. 마지막 항목을 제외하고 각 항목은 라인피드로 끝납니다 (`n).

Controls are sorted according to their Z-order, which is usually the same order as the navigation order via Tab if the window supports tabbing.

Transparent

Retrieves the degree of transparency of a window.

WinGet, OutputVar, Transparent , WinTitle, WinText, ExcludeTitle, ExcludeText

투명도를 설정하는 방법은 WinSet을 참조하십시오. 다음과 같은 경우 OutputVar이 비워집니다: 1) OS가 Windows XP보다 구형입니다; 2) 부합하는 창이 없습니다; 3) 창에 투명도 레벨이 없습니다; 4) (OS 행위로 야기된) 기타 조건. 예를 들어 창을 투명하게 만든 이후로 최소화, 복구, 또는 크기가 바뀌었습니다. 그렇지 않으면, 0부터 255 사이의 숫자가 저장됩니다. 0은 보이지 않는 창을 나타내고 255는 완전 불투명 창을 나타냅니다. 예를 들어:

MouseGetPos,,, MouseWin
WinGet, Transparent, Transparent, ahk_id %MouseWin%  ; 마우스 아래의 창이 투명도.

TransColor

창에서 투명으로 표식이 붙은 색을 열람합니다.

WinGet, OutputVar, TransColor , WinTitle, WinText, ExcludeTitle, ExcludeText

See WinSet for how to set the TransColor. 다음과 같은 경우 OutputVar이 비워집니다: 1) OS가 Windows XP보다 오래되었습니다; 2) 부합하는 창이 없습니다; 3) 창에 투명 색이 없습니다; 4) 또는 (OS 행위로 야기된) 기타 조건. 예를 들어 창을 투명하게 만든 이후로 최소화, 복구, 또는 크기가 바뀌었습니다. 그렇지 않으면, 여섯자리 십육진 RGB 색이 저장됩니다. 예, 0x00CC99. 예를 들어:

MouseGetPos,,, MouseWin
WinGet, TransColor, TransColor, ahk_id %MouseWin%  ; 마우스 커서 아래에 있는 창의 TransColor.

Style

Retrieves an 8-digit hexadecimal number representing the style of a window.

WinGet, OutputVar, Style , WinTitle, WinText, ExcludeTitle, ExcludeText

부합하는 창이 없으면, OutputVar는 비워집니다. 다음 예제는 창에 WS_DISABLED 스타일이 있는지 알아봅니다:

WinGet, Style, Style, My Window Title
if (Style & 0x8000000)  ; 0x8000000은 WS_DISABLED입니다.
  MsgBox The window is disabled.

스타일 목록은 스타일 테이블을 참조하십시오.

ExStyle

Retrieves an 8-digit hexadecimal number representing the extended style of a window.

WinGet, OutputVar, ExStyle , WinTitle, WinText, ExcludeTitle, ExcludeText

부합하는 창이 없으면, OutputVar는 비워집니다. The following example determines whether a window has the WS_EX_TOPMOST style (always-on-top):

WinGet, ExStyle, ExStyle, My Window Title
if (ExStyle & 0x8)  ; 0x8은 WS_EX_TOPMOST입니다.
   MsgBox The window is always-on-top.

스타일 목록은 스타일 테이블을 참조하십시오.

논평

창의 ID 번호는 오직 창이 살아 있을 동안에만 유효합니다. 다른 말로, 어플리케이션이 재시작하면, 그의 모든 창은 새 ID 번호를 얻습니다.

이 명령어로 열람된 ID 번호는 숫자이고 (앞에 접두어 "ahk_id"를 포함하지 않음) 그리고 SetFormat의 설정에 상관없이 16진 형식으로 저장됩니다.

마우스 커서 아래에 있는 창의 ID는 MouseGetPos로 열람할 수 있습니다.

ID 번호는 현재 32-비트 부호없는 정수이지만, 앞으로 64-비트가 될 가능성이 있습니다. 그러므로, 이런 값들에 대해 덧셈을 하는 것과 같은 숫치 연산을 수행하는 것은 안전하지 않습니다. 왜냐하면 그런 연산은 입력 문자열을 부호없는 정수가 아니라 부호있는 정수로 해석할 필요가 있기 때문입니다.

창 제목과 텍스트는 대소문자를 구분합니다. 숨은 창은 DetectHiddenWindows가 켜져 있어야 탐지됩니다.

WinGetClass, Process, WinGetTitle, MouseGetPos, ControlGet, ControlFocus, GroupAdd

예제

활성 창을 최대화하고 그의 유일 ID를 보고합니다.

WinGet, active_id, ID, A
WinMaximize, ahk_id %active_id%
MsgBox, 활성 창의 ID는 "%active_id%"입니다.

Visits all windows on the entire system and displays info about each of them.

WinGet, id, List,,, Program Manager
Loop, %id%
{
    this_id := id%A_Index%
    WinActivate, ahk_id %this_id%
    WinGetClass, this_class, ahk_id %this_id%
    WinGetTitle, this_title, ahk_id %this_id%
    MsgBox, 4, , Visiting All Windows`n%A_Index% of %id%`nahk_id %this_id%`nahk_class %this_class%`n%this_title%`n`nContinue?
    IfMsgBox, NO, break
}

Extracts the individual control names from the active window's control list.

WinGet, ActiveControlList, ControlList, A
Loop, Parse, ActiveControlList, `n
{
    MsgBox, 4,, Control #%A_Index% is "%A_LoopField%". 계속할까요?
    IfMsgBox, No
        break
}

실시간으로 활성 창의 콘트롤 리스트를 보여줍니다.

#Persistent
SetTimer, WatchActiveWindow, 200
return

WatchActiveWindow:
WinGet, ControlList, ControlList, A
ToolTip, %ControlList%
return