</head> <body> <h1>라벨</h1> <h2 id="toc">목차</h2> <ul> <li><a href="#syntax-and-usage">Syntax and Usage</a></li> <li><a href="#subroutines">서브루틴</a></li> <li><a href="#dynamic-labels">동적인 라벨</a></li> <li><a href="#hotkeys-and-hotstrings">핫키와 핫스트링</a></li> <li><a href="#named-loops">이름있는 회돌이</a></li> <li><a href="#Functions">함수</a></li> <li><a href="#related">관련 항목</a></li> </ul> <h2 id="syntax-and-usage">Syntax and Usage</h2> <p>라벨은 코드 한 줄을 식별합니다. <a href="../lib/Goto.htm">Goto</a>의 목표나 <a href="#subroutines">서브루틴</a>을 형성하는 데 사용할 수 있습니다. There are three kinds of label: normal named labels, <a href="../Hotkeys.htm">hotkey</a> labels and <a href="../Hotstrings.htm">hotstring</a> labels.</p> <p>Normal labels consist of a name followed by a colon.</p> <pre>this_is_a_label: </pre> <p>Hotkey labels consist of a hotkey followed by double-colon.</p> <pre>^a:: </pre> <p>Hotstring labels consist of a colon, zero or more <a href="../Hotstrings.htm#Options">options</a>, another colon, an abbreviation and double-colon.</p> <pre>:*:btw:: </pre> <p>Generally, aside from whitespace and comments, no other code can be written on the same line as a label. However:</p> <ul> <li>A hotkey label can be directly followed by a command or other statement to create a <em>one-line</em> hotkey. In other words, if a command, assignment or expression is present on the same line as a hotkey label, it acts as though followed by <code>return</code>.</li> <li>A hotkey with a <a href="../KeyList.htm">key name</a> written to the right of the double-colon is actually a <a href="Remap.htm"><em>remapping</em></a>, which is shorthand for <a href="Remap.htm#actually">a pair of hotkeys</a>. For example, <code>a::b</code> creates hotkeys and labels for <code>*a</code> and <code>*a Up</code>, and does not create a label named <code>a</code>.</li> <li>A hotstring with text written to the right of the final double-colon is an <em>auto-replace</em> hotstring. Auto-replace hotstrings do not act as labels.</li> </ul> <p><strong>이름:</strong> 라벨 이름은 대소문자를 구분하지 않으며, 스페이스나 탭 그리고 쉼표와 <a href="EscapeChar.htm">피신 문자</a> (`)를 제외하고 어떤 문자로도 구성할 수 있습니다. 그렇지만, 스타일 관례 때문에, 일반적으로 오직 기호와 숫자 그리고 밑줄 문자를 사용하는 편이 좋습니다 (예를 들어: <em>MyListView</em>, <em>Menu_File_Open</em>, and <em>outer_loop</em>). 라벨 이름은 전체 스크립트를 통해 유일해야 합니다.</p> <p>예약된 이름은 없지만, 다음 이름은 사용하지 않기를 강력하게 권고합니다: On, Off, Toggle, AltTab, ShiftAltTab, AltTabAndMenu 그리고 AltTabMenuDismiss. 이런 값들은 <a href="../lib/Hotkey.htm">Hotkey 명령어</a>에 특별한 의미가 있습니다.</p> <p><strong>목표:</strong> 라벨의 목표는 실행 코드의 다음 줄입니다. 실행 코드에는 명령어, 할당, <a href="../Variables.htm#Expressions">표현식</a> 그리고 <a href="../lib/Block.htm">블록</a>이 담길 수 있지만, 지시어나 라벨, 핫키와 핫스트링은 안됩니다. 다음 예제에서, <code>run_notepad</code>와 <code>#n</code>는 모두 <code>Run</code> 라인을 가리킵니다:</p> <pre>run_notepad: #n:: Run Notepad return </pre> <p><strong>실행:</strong> 지시어처럼, 라벨은 정상 실행 흐름에 도달하면 아무 효과도 없습니다. 다음 예제에서 메시지 박스는 두번 나타납니다 - 한 번은 <a href="../lib/Gosub.htm">Gosub</a>에 의한 서브루틴의 실행 동안에, 그리고 다시 서브루틴이 반환된 후에 나타납니다:</p> <pre>gosub Label1 Label1: MsgBox <a href="../Variables.htm#ThisLabel">%A_ThisLabel%</a> return</pre> <h2 id="subroutines">서브루틴</h2> <p>서브루틴은 특정한 작업을 위해 <em>호출할 수 있는</em> 코드 일부입니다. 서브루틴의 실행은 라벨이 목표에서 시작해서 <a href="../lib/Return.htm">Return</a>이나 <a href="../lib/Exit.htm">Exit</a>을 만날 때까지 계속됩니다. 서브루틴의 종료는 실행 흐름에 달려 있기 때문에, 어떤 라벨이든 Goto 목표와 서브루틴의 시작으로 행위할 수 있습니다.</p> <h2 id="dynamic-labels">동적인 라벨</h2> <p>라벨을 받는 많은 명령어들은 또 %MyLabel%와 같이 <a href="../Variables.htm">변수 참조</a>도 받을 수 있습니다. 이 경우 변수에 저장된 이름이 목표로 사용됩니다. 그렇지만, 수행성능은 약간 줄어듭니다. 왜냐하면 목표 라벨을 스크립트가 처음 적재될 때 "한 번만 찾아 보는 것이 아니라" 매번 찾아 보아야 하기 때문입니다.</p> <h2 id="hotkeys-and-hotstrings">핫키와 핫스트링</h2> <p>Each <a href="../Hotkeys.htm">double-colon hotkey</a> also creates a label, unless it is a <a href="../Hotkeys.htm#Function">function hotkey</a>. The label's name is exactly as written in the script, and can differ from the hotkey's name as reported by <a href="../Variables.htm#ThisHotkey">A_ThisHotkey</a>, such as if the modifiers are written in a different order. The label name includes the hotkey's modifiers but not the final double-colon (<code>::</code>).</p> <p>A <a href="../Hotstrings.htm#label">hotstring label</a>'s name includes the leading colon and options, but not the final double-colon (<code>::</code>).</p> <p><a href="../Hotkeys.htm">핫키</a>와 <a href="../Hotstrings.htm#label">핫스트링 라벨</a>도 <a href="../lib/Goto.htm">Goto</a>, <a href="../lib/Gosub.htm">Gosub</a> 그리고 기타 명령어에 대하여 유효합니다. However, a hotkey or hotstring label can only be used in this manner if it is the first label with the given name. 예를 들어:</p> <pre>gosub ^+a <em>; Example hotkey.</em> gosub +^a <em>; Global hotkey.</em> gosub Esc <em>; Esc label.</em> ExitApp #IfWinActive Example ^+a::MsgBox Example hotkey. Esc: MsgBox Esc label. return #If +^a::MsgBox Global hotkey. Esc::MsgBox Esc hotkey.</pre> <p>This limitation also applies to the <a href="../lib/Hotkey.htm">Hotkey</a> command's <em>Label</em> parameter.</p> <h2 id="named-loops">이름있는 회돌이</h2> <p>라벨은 또 <a href="../lib/Continue.htm">Continue</a>와 <a href="../lib/Break.htm">Break</a> 명령어에 대하여 회돌이를 식별하는 데에도 사용할 수 있습니다. 스크립트는 쉽게 깊이에 상관없이 내포 회돌이를 계속하거나 빠져 나올 수 있습니다.</p> <h2 id="Functions">함수</h2> <p><span class="ver">[v1.1.20+]</span>: <a href="../Functions.htm">함수</a>는 많은 경우 라벨을 대신해 사용할 수 있습니다. 여기에는:</p> <ul> <li><a href="../lib/Gui.htm#Labels">Gui 이벤트</a> 예, GuiClose</li> <li><a href="../lib/Gui.htm#label">구이 콘트롤 이벤트</a> (g-labels)</li> <li><a href="../lib/Hotkey.htm#Functor">Hotkey</a></li> <li><a href="../lib/Menu.htm#Functor">Menu</a></li> <li><a href="../lib/SetTimer.htm#Functor">SetTimer</a></li> </ul> <p></p> <p>함수의 혜택은 지역 변수를 사용할 수 있다는 것입니다. (Gui 제어 이벤트와 같이) 어떤 경우 유용한 정보를 담고 있는 매개변수를 받기도 합니다.</p> <h2 id="related">관련 항목</h2> <p><a href="../lib/IsLabel.htm">IsLabel()</a>, <a href="../Variables.htm#ThisLabel">A_ThisLabel</a>, <a href="../lib/Gosub.htm">Gosub</a>, <a href="../lib/Goto.htm">Goto</a>, <a href="../lib/OnExit.htm#command">OnExit</a>, <a href="../lib/SetTimer.htm">SetTimer</a>, <a href="../lib/Hotkey.htm">Hotkey</a>, <a href="../lib/Gui.htm#Labels">Gui Events</a>, <a href="../lib/Gui.htm#label">g-label</a>, <a href="../lib/OnClipboardChange.htm#label">OnClipboardChange Label</a></p> </body> </html>