2014-09-30 72 views
2

如何在按下“是”示例的情况下继续执行脚本?AutoHotKey - MsgBox(否则/如果)

;Print FIA Forside. 
MsgBox, 4, Print Forside?, Vil du printe en forside til denne sending? (press Yes or No 
IfMsgBox Yes 

;Find the shipment in EDI - Open the excel file and print it! 
    Click 2206,581 
    Click 1435,326 
    Send {Ctrl Down}c{Ctrl Up} 
    Click 1886,1044 


else 
    MsgBox You pressed No. 

我得到以下错误:

Error: ELSE with no matching IF 

回答

4

您使用大括号来包装你的代码。像这样:

;Print FIA Forside. 
MsgBox, 4, Print Forside?, Vil du printe en forside til denne sending? (press Yes or No) 
IfMsgBox Yes 
{ 
    msgBox, You pressed yes! 
    ; Put more code here 
} 
else 
{ 
    msgBox, You pressed no! 
}