2014-04-18 29 views

回答

0

此代碼工作:

Esc::goto ExitThisProgramQuestion 

ExitThisProgramQuestion: 
    MsgBox, 4, , Are we exiting? 
    IfMsgBox, No 
     return 
    ExitApp 
return 
1

您必須在腳本中添加ExitApp作爲命令!這是一種特殊的標籤,而不是功能。如果腳本中不存在標籤,則不能調用它。

爲了使其存在,只需在其上添加另一條帶有標籤的行。 - >>其實,我說錯了。在文檔中,它提供了一個示例,即使您不首先創建該腳本,因爲它已內置到AutoHotkey中,您也可以使用Esc::ExitApp這樣的腳本退出正在運行的腳本ExitApp。然而,隨着從您的評論你的新代碼,您可以使用自定義標籤(它在你的腳本存在之前,你可以調用它):

Esc::goto DoSomething 

DoSomething: 
    MsgBox, 4, , Are we exiting? 
    IfMsgBox, No 
     return ;after this return, the next line will not be called. 
    ExitApp ;as soon as this is called, the script ends completely and no more of the script will ever be called 
return 
+0

我做錯了什麼,這個過程永遠不會運行,雖然AutoHotkey退出? Esc :: ExitApp; ExitApp { MsgBox,4,,我們正在退出嗎? IfMsgBox,No return } – user3549668

+0

你不能這樣做。 (抱歉很久 - 我正在度假)。 'ExitApp'是一個特殊的命令標籤。我會在這裏用新代碼更新我的答案。 – bgmCoder

+0

感嘆。 Error.DoSomething - 此行不包含已識別的動作 – user3549668

相關問題