</head> <body> <h1>ControlGet</h1> <p>콘트롤에 관하여 다양한 유형의 정보를 열람합니다.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, <a href="#SubCommands">SubCommand</a> <span class="optional">, Value, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <h2 id="Parameters">매개변수</h2> <dl> <dt>OutputVar</dt> <dd>The name of the output variable in which to store the result of <em>SubCommand</em>.</dd> <dt>SubCommand, Value</dt> <dd>These are dependent upon each other and their usage is described <a href="#SubCommands">below</a>.</dd> <dt>Control</dt> <dd> <p>ClassNN (콘트롤의 클래스이름과 실체 번호) 또는 콘트롤의 텍스트일 수 있습니다. 둘 모두 Window Spy로 알아낼 수 있습니다. 텍스트를 사용할 때, 부합하는 행위는 <a href="SetTitleMatchMode.htm">SetTitleMatchMode</a>로 결정됩니다. 이 매개변수가 비어 있으면, 목표 창의 최상위 콘트롤이 사용됩니다.</p> <p>콘트롤의 HWND (창 핸들)에 작동시키려면, <em>Control</em> 매개변수를 빈 채로 두고 <code>ahk_id %ControlHwnd%</code>를 <em>WinTitle</em> 매개변수에 지정하십시오 (이것은 숨은 창에도 작동합니다. <a href="DetectHiddenWindows.htm">DetectHiddenWindows</a>가 꺼져 있어도 상관 없습니다). 콘트롤의 HWND는 전형적으로 <a href="#Hwnd">ControlGet Hwnd</a>, <a href="MouseGetPos.htm">MouseGetPos</a>, 또는 <a href="DllCall.htm">DllCall()</a>을 통하여 열람됩니다.</p> </dd> <dt>WinTitle</dt> <dd>목표 창을 식별하는 창 제목 또는 다른 기준. <a href="../misc/WinTitle.htm">WinTitle</a> 참조.</dd> <dt>WinText</dt> <dd>존재하면, 이 매개변수는 목표 창 텍스트의 부문자열입니다 (동봉된 Window Spy 유틸리티에 노출됨). 숨은 텍스트는 <a href="DetectHiddenText.htm">DetectHiddenText</a>가 켜져 있어야 탐지됩니다.</dd> <dt>ExcludeTitle</dt> <dd>제목에 이 값이 있는 창은 무시합니다.</dd> <dt>ExcludeText</dt> <dd>텍스트에 이 값이 있는 창은 무시합니다.</dd> </dl> <h2 id="SubCommands">부-명령어</h2> <p>For <em>SubCommand</em>, specify one of the following:</p> <ul> <li><a href="#List">List</a>: ListView, ListBox, ComboBox, 또는 DropDownList로부터 항목 리스트를 열람합니다.</li> <li><a href="#Checked">Checked</a>: Retrieves 1 if the checkbox or radio button is checked or 0 if not.</li> <li><a href="#Enabled">Enabled</a>: 콘트롤이 켜져 있으면 1이 열람되고 꺼져 있으면 0이 열람됩니다.</li> <li><a href="#Visible">Visible</a>: 콘트롤이 보이면 1을 열람하고 보이지 않으면 0을 열람합니다.</li> <li><a href="#Tab">Tab</a>: Retrieves the tab number of a SysTabControl32 control.</li> <li><a href="#FindString">FindString</a>: Retrieves the entry number of a ListBox or ComboBox that is an exact match for the string.</li> <li><a href="#Choice">Choice</a>: Retrieves the name of the currently selected entry in a ListBox or ComboBox.</li> <li><a href="#LineCount">LineCount</a>: Retrieves the number of lines in an Edit control.</li> <li><a href="#CurrentLine">CurrentLine</a>: Retrieves the line number in an Edit control where the caret resides.</li> <li><a href="#CurrentCol">CurrentCol</a>: Retrieves the column number in an Edit control where the caret resides.</li> <li><a href="#Line">Line</a>: Retrieves the text of the specified line number in an Edit control.</li> <li><a href="#Selected">Selected</a>: Retrieves the selected text in an Edit control.</li> <li><a href="#Style">Style</a>: 콘트롤의 스타일을 나타내는 8-자리 십육진 수를 열람합니다.</li> <li><a href="#ExStyle">ExStyle</a>: 콘트롤의 확장 스타일을 나타내는 8-자리 십육진 수를 열람합니다.</li> <li><a href="#Hwnd">Hwnd</a> <span class="ver">[v1.1.04+]</span>: 콘트롤의 창 핸들(HWND)을 열람합니다.</li> </ul> <h3 id="List">List</h3> <p>ListView, ListBox, ComboBox, 또는 DropDownList로부터 항목 리스트를 열람합니다. For ListView, additional options can be specified.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, List <span class="optional">, Options, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <h4 id="ListView">ListView</h4> <p><em>Options</em> 매개변수가 비어 있거나 생략되면, 콘트롤에 있는 모든 텍스트가 열람됩니다. 마지막 행을 제외하고 각 행마다 라인피드 문자로 끝납니다 (`n). 각 행 안에서, 각 필드 (컬럼)은 마지막을 제외하고 탭 문자로 끝납니다 (`t).</p> <p><em>Options</em>에 다음 단어들을 지정하십시오. 각 옵션은 다음 옵션과 스페이스 또는 탭으로 구분됩니다:</p> <table class="info"> <tr> <th>옵션</th> <th abbr="설명">설명</th> </tr> <tr> <td>Selected</td> <td>모든 행 말고 선택된 (강조된) 행들만 열람합니다. 아무것도 없으면, <em>OutputVar</em>는 비워집니다.</td> </tr> <tr> <td>Focused</td> <td>초점 행만 열람합니다. 아무것도 없으면, <em>OutputVar</em>는 비워집니다.</td> </tr> <tr id="ColN"> <td>Col4</td> <td>모든 컬럼 말고 네 번째 컬럼(필드)만 열람합니다 (4를 원하는 번호로 교체).</td> </tr> <tr> <td>Count</td> <td>콘트롤에 있는 전체 행의 개수를 열람합니다.</td> </tr> <tr> <td>Count&nbsp;Selected</td> <td>선택된 (강조된) 행의 개수를 열람합니다.</td> </tr> <tr> <td>Count&nbsp;Focused</td> <td>초점 행의번호(위치)를 열람합니다 (없으면 0).</td> </tr> <tr> <td>Count&nbsp;Col</td> <td>콘트롤에 있는 컬럼의 개수를 열람합니다 (또는 개수를 셀 수 없으면 -1).</td> </tr> </table> <p class="note"><strong>주의</strong>: 어떤 어플리케이션은 ListView 텍스트를 따로 보관합니다. 그 때문에 텍스트를 열람할 수 없습니다. 이런 경우, ErrorLevel은 보통 0으로 설정됩니다 (성공을 뜻함). 그러나 열람된 필드는 비어 있을 것입니다. 또한 ListView 텍스트 열람은 <a href="_MaxMem.htm">#MaxMem</a>으로 제한되지 않습니다.</p> <p>성공하면, ErrorLevel은 0이 설정됩니다. 실패하면 1로 설정되고 <em>OutputVar</em>는 비워집니다. 실패는 다음과 같은 경우 일어납니다: 1) 목표 창이나 콘트롤이 존재하지 않는다; 2) 목표 창이 SysListView32 유형이 아니다; 3) ListView를 소유한 프로세스를 열 수 없다. 아마도 사용자가 권한이 없거나 잠겨 있기 때문일 것이다; 4) <a href="#ColN">Col<em>N</em> 옵션</a>에 존재하지 않는 컬럼을 지정했다.</p> <p>ListView로부터 개별적으로 행과 필드를 추출하려면, 다음 예제와 같이 <a href="LoopParse.htm">파싱 회돌이</a>를 사용하십시오:</p> <pre>ControlGet, SelectedItems, List, Selected, SysListView321, <i>WinTitle</i> Loop, Parse, SelectedItems, `n <em>; 행은 라인피드로 구분됩니다 (`n).</em> { RowNumber := A_Index Loop, Parse, A_LoopField, %A_Tab% <em>; 각 행의 필드 (컬럼)은 탭으로 구분됩니다 (A_Tab).</em> MsgBox Row #%RowNumber% Col #%A_Index% is %A_LoopField%. }</pre> <p>관련하여 말씀 드리자면, ListView의 컬럼은 <a href="PostMessage.htm">SendMessage</a>를 통하여 크기를 변경할 수 있습니다. 다음 예제에 보여줍니다:</p> <pre>SendMessage, 0x101E, 0, 80, SysListView321, <i>WinTitle</i> <em>; 0x101E은 LVM_SETCOLUMNWIDTH입니다.</em></pre> <p>위에서, 0은 첫 컬럼을 나타냅니다 (1은 두 번째, 2는 세 번째, 등등.) 또한, 80은 새 너비입니다. 80을 -1로 바꾸면 컬럼의 크기가 자동으로 조절됩니다. -2로 교체하면 헤더 텍스트 너비까지 고려하여 크기를 조절해 줍니다.</p> <h4 id="ListBox_ComboBox_DropDownList">ListBox, ComboBox, DropDownList</h4> <p>콘트롤로부터 모든 텍스트가 열람됩니다 (즉, 위의<em>Count</em>과 <em>Selected</em>같은 ListView 옵션은 지원하지 않습니다).</p> <p>Each item except the last will be terminated by a linefeed character (`n). 항목에 개별적으로 접근하려면, 다음 예제와 같이 <a href="LoopParse.htm">파싱 회돌이</a>를 사용하십시오:</p> <pre>ControlGet, Items, List,, ComboBox1, <i>WinTitle</i> Loop, Parse, Items, `n MsgBox Item number %A_Index% is %A_LoopField%.</pre> <h3 id="Checked">Checked</h3> <p>Retrieves 1 if the checkbox or radio button is checked or 0 if not.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Checked <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <h3 id="Enabled">Enabled</h3> <p>Retrieves 1 if <em>Control</em> is enabled, or 0 if disabled.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Enabled <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <h3 id="Visible">Visible</h3> <p>Retrieves 1 if <em>Control</em> is visible, or 0 if hidden.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Visible <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <h3 id="Tab">Tab</h3> <p>Retrieves the tab number of a SysTabControl32 control.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Tab <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>첫 탭은 1, 두 번째 탭은 2입니다, 등등. 대신에 얼마나 많은 탭(페이지)가 탭 콘트롤에 있는지 알아 보려면, 다음 예제를 따르십시오:</p> <pre><a href="PostMessage.htm">SendMessage</a>, 0x1304,,, SysTabControl321, <i>WinTitle</i> <em>; 0x1304는 TCM_GETITEMCOUNT입니다.</em> TabCount := ErrorLevel</pre> <h3 id="FindString">FindString</h3> <p>Retrieves the entry number of a ListBox or ComboBox that is an exact match for <em>String</em>.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, FindString, String <span class="optional">, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>콘트롤의 첫 엔트리는 1이고, 두 번째 엔트리는 2입니다, 등등. 일치가 없으면, <em>OutputVar</em>는 비워지고 ErrorLevel은 1로 설정됩니다.</p> <h3 id="Choice">Choice</h3> <p>Retrieves the name of the currently selected entry in a ListBox or ComboBox.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Choice <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>대신에 선택된 항목의 위치를 열람하려면, 다음 예제를 따르십시오 (앞의 두 줄만 사용합니다):</p> <pre><a href="PostMessage.htm">SendMessage</a>, 0x0188, 0, 0, ListBox1, <i>WinTitle</i> <em>; 0x0188은 LB_GETCURSEL입니다 (ListBox).</em> <a href="PostMessage.htm">SendMessage</a>, 0x0147, 0, 0, ComboBox1, <i>WinTitle</i> <em>; 0x0147은 CB_GETCURSEL입니다 (DropDownList 또는 ComboBox).</em> ChoicePos := ErrorLevel&lt;&lt;32&gt;&gt;32 <em>; Convert UInt to Int to have -1 if there is no item selected.</em> ChoicePos += 1 <em>; 0-기반에서 1-기반으로 변환합니다. 그래서 첫 항목은 0이 아니라, 1입니다.</em></pre> <h3 id="LineCount">LineCount</h3> <p>Retrieves the number of lines in an Edit control.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, LineCount <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>모든 Edit 콘트롤은 콘트롤이 비어 있을지라도 적어도 1 줄이 있습니다.</p> <h3 id="CurrentLine">CurrentLine</h3> <p>Retrieves the line number in an Edit control where the caret (insert point) resides.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, CurrentLine <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>첫 줄은 1입니다. 콘트롤에 선택된 텍스트가 있다면, 선택이 시작하는 곳의 줄 번호를 <em>OutputVar</em>에 설정합니다.</p> <h3 id="CurrentCol">CurrentCol</h3> <p>Retrieves the column number in an Edit control where the caret (text insertion point) resides.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, CurrentCol <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>첫 열은 1입니다. 선택된 텍스트가 콘트롤에 있다면, <em>OutputVar</em>에 선택이 시작되는 곳의 열 번호가 설정됩니다.</p> <h3 id="Line">Line</h3> <p>Retrieves the text of line <em>N</em> in an Edit control.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Line, N <span class="optional">, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>Line 1은 첫 줄입니다. 콘트롤의 특성에 따라, <em>OutputVar</em>는 캐리지 리턴 (`r) 또는 캐리지 리턴 + 라인피드 (`r`n)로 끝날 수 있습니다. 지정된 줄 번호가 비어 있거나 존재하지 않으면, <a href="../misc/ErrorLevel.htm">ErrorLevel</a> 에 1이 설정되고 <em>OutputVar</em>는 비워집니다.</p> <h3 id="Selected">Selected</h3> <p>Retrieves the selected text in an Edit control.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Selected <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>아무 텍스트도 선택되어 있지 않으면, <em>OutputVar</em>는 비워지고 ErrorLevel에는 0이 설정됩니다 (즉, 에러 없음). 어떤 유형의 콘트롤은 RichEdit20A와 같이 어떤 경우 올바르게 텍스트를 생산하지 않을 수 있습니다 (예, Metapad).</p> <h3 id="Style">Style</h3> <p>콘트롤의 스타일을 나타내는 8-자리 십육진 수를 열람합니다.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Style <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>스타일 목록은 <a href="../misc/Styles.htm">스타일 테이블</a>을 참조하십시오.</p> <h3 id="ExStyle">ExStyle</h3> <p>콘트롤의 확장 스타일을 나타내는 8-자리 십육진 수를 열람합니다.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, ExStyle <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>스타일 목록은 <a href="../misc/Styles.htm">스타일 테이블</a>을 참조하십시오.</p> <h3 id="Hwnd">Hwnd <span class="ver">[v1.0.43.06+]</span></h3> <p>콘트롤의 창 핸들(HWND)을 열람합니다.</p> <pre class="Syntax"><span class="func">ControlGet</span>, OutputVar, Hwnd <span class="optional">,, Control, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <p>예를 들어: <code>ControlGet, OutputVar, Hwnd,, Edit1, <i>WinTitle</i></code>. 콘트롤의 HWND는 종종 <a href="PostMessage.htm">PostMessage</a>, <a href="PostMessage.htm">SendMessage</a>, 그리고 <a href="DllCall.htm">DllCall</a>에 사용됩니다. 관련하여 말씀 드리자면, 콘트롤의 HWND는 <a href="MouseGetPos.htm">MouseGetPos</a>를 통해서 열람할 수도 있습니다. 마지막으로, 콘트롤의 HWND를 <a href="../misc/WinTitle.htm#ahk_id">ahk_id WinTitle</a>로 직접적으로 사용할 수 있습니다 (이것은 숨은 콘트롤에도 작동합니다. <a href="DetectHiddenWindows.htm">DetectHiddenWindows</a>가 꺼져 있어도 상관없습니다).</p> <h2 id="Error_Handling">에러 처리</h2> <p><span class="ver">[v1.1.04+]</span>: 이 명령어는 실패하면 예외를 던질 수 있습니다. 더 자세한 정보는 <a href="Catch.htm#RuntimeErrors">실행시간 에러</a>를 참조하십시오.</p> <p>성공하면, <a href="../misc/ErrorLevel.htm">ErrorLevel</a>은 0이 설정됩니다. 문제가 발생하면 -- 존재하지 않는 창이나 콘트롤 같은 경우 -- <a href="../misc/ErrorLevel.htm">ErrorLevel</a>은 1이 설정되고 <em>OutputVar</em>는 비워집니다.</p> <h2 id="Remarks">논평</h2> <p>콘트롤을 변경하는 명령어와 다르게, ControlGet은 자동 지연이 없습니다; 즉, <a href="SetControlDelay.htm">SetControlDelay</a>에 영향을 받지 않습니다.</p> <p>현재 마우스가 떠 있는 콘트롤의 ClassNN 또는 HWND를 발견하려면, <a href="MouseGetPos.htm">MouseGetPos</a>를 사용하십시오. 창의 모든 콘트롤 목록을 열람하려면, <a href="WinGet.htm#ControlList">WinGet ControlList</a>를 사용하십시오.</p> <p>창 제목과 텍스트는 대소문자를 구분합니다. 숨은 창은 <a href="DetectHiddenWindows.htm">DetectHiddenWindows</a>가 켜져 있어야 탐지됩니다.</p> <h2 id="Related">관련 항목</h2> <p><a href="Control.htm">Control</a>, <a href="GuiControlGet.htm">GuiControlGet</a>, <a href="ControlMove.htm">ControlMove</a>, <a href="ControlGetText.htm">ControlGetText</a>, <a href="ControlSetText.htm">ControlSetText</a>, <a href="ControlGetPos.htm">ControlGetPos</a>, <a href="ControlClick.htm">ControlClick</a>, <a href="ControlFocus.htm">ControlFocus</a>, <a href="ControlSend.htm">ControlSend</a>, <a href="WinGet.htm">WinGet</a></p> <h2 id="Examples">예제</h2> <div class="ex" id="ExLine"> <p><a class="ex_number" href="#ExLine"></a> Retrieves the first line of the first Edit control.</p> <pre>ControlGet, OutputVar, Line, 1, Edit1, Some Window Title</pre> </div> <div class="ex" id="ExTab"> <p><a class="ex_number" href="#ExTab"></a> Retrieves the currently active tab of the first Tab control.</p> <pre>ControlGet, WhichTab, Tab,, SysTabControl321, Some Window Title if ErrorLevel MsgBox There was a problem. else MsgBox Tab #%WhichTab% is active.</pre> </div> </body> </html>