AutoHotKey를 사용하는 사람들
오늘: 515
어제: 547
전체: 199,712
회원: 1,877
접속: 31 (회원 3)

Exit

원문보기
수정요청

Exits the current thread or (if the script is not persistent contains no hotkeys) the entire script.

Exit [, ExitCode]

Parameters

ExitCode An integer (i.e. negative, positive, zero, or an expression) that is returned to its caller when the script exits. This code is accessible to any program that spawned the script, such as another script (via RunWait) or a batch (.bat) file. If omitted, ExitCode defaults to zero. Zero is traditionally used to indicate success. Note: Windows 95 may be limited in how large ExitCode can be.

Remarks

If the script has no hotkeys, isn't persistent, and hasn't requested the Num/Scroll/CapsLock key(s) to be kept AlwaysOn or AlwaysOff, it will terminate immediately when Exit is encountered (except if it has an OnExit subroutine).

Otherwise, the Exit command terminates the current thread. In other words, the stack of subroutines called directly or indirectly by a menu, timer, or hotkey subroutine will all be returned from as though a Return were immediately encountered in each. If used directly inside such a subroutine -- rather than in one of the subroutines called indirectly by it -- Exit is equivalent to Return.

Use ExitApp to completely terminate a script that is persistent or contains hotkeys.

관련 명령어

ExitApp, OnExit, Functions, Gosub, Return, Threads, #Persistent

예제

#z::
Gosub, Sub2
MsgBox, This msgbox will never happen because of the EXIT.
return

Sub2:
Exit  ; Terminate this subroutine as well as the calling subroutine.

 

Copyright Tleap. All rights reserved.