If statement 跳过脚本其他部分中的第一个操作?
当我投射以下脚本时,将跳过重音线。谁能告诉我为什么?如何修复此问题,使脚本正常工作If statement 跳过脚本其他部分中的第一个操作?,if-statement,autohotkey,If Statement,Autohotkey,当我投射以下脚本时,将跳过重音线。谁能告诉我为什么?如何修复此问题,使脚本正常工作 MsgBox, 3, , Dimensions?, Wide (yes)? Landscape (no)? IfMsgBox, Yes Send ^+{PrintScreen} Sleep 1500 MouseClickDrag, left, 0, 200, 600, 400 Sleep 1000 Send 1 Return IfMsgBox, No /
MsgBox, 3, , Dimensions?, Wide (yes)? Landscape (no)?
IfMsgBox, Yes
Send ^+{PrintScreen}
Sleep 1500
MouseClickDrag, left, 0, 200, 600, 400
Sleep 1000
Send 1
Return
IfMsgBox, No
//SKIPPED
//SKIPPED
Send ^+{PrintScreen}
//Skipped
//Skipped
Sleep 1500
MouseClickDrag, left, 0, 200, 600, 400
Sleep 1000
Send 1
Return
IfMsgBox, Cancel
//SKIPPED
//SKIPPED
Send ^+{PrintScreen}
//Skipped
//Skipped
Sleep 1500
MouseClickDrag, left, 0, 200, 600, 400
Sleep 1000
Send 1
Return
除非使用花括号,否则只有IF语句后的第一行才会被视为该语句的一部分。试试这个。B.t.w.您是否意识到所有3个If都执行完全相同的代码
MsgBox, 3, , Dimensions?, Wide (yes)? Landscape (no)?
IfMsgBox, Yes
{
Send ^+{PrintScreen}
Sleep 1500
MouseClickDrag, left, 0, 200, 600, 400
Sleep 1000
Send 1
Return
}
IfMsgBox, No
{
Send ^+{PrintScreen}
Sleep 1500
MouseClickDrag, left, 0, 200, 600, 400
Sleep 1000
Send 1
Return
}
IfMsgBox, Cancel
{
Send ^+{PrintScreen}
Sleep 1500
MouseClickDrag, left, 0, 200, 600, 400
Sleep 1000
Send 1
Return
}
验证正确。在使每个块的内容相同之前,我选中了empty else块。这是学习新语言时在测试中完成的设计步骤。