AutoHotKey - MsgBox(Else / If)

时间:2014-09-30 07:32:32

标签: scripting autohotkey

如果按下示例“是”,如何在消息框中继续编写脚本?

 ;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

1 个答案:

答案 0 :(得分: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!
}