【发布时间】:2015-03-24 03:33:00
【问题描述】:
我正在尝试自动化生成模板以向我们的外包提供商请求体检的过程。脚本中有六个 GUI:
- 特别说明
- 列出即将到来的约会
- 联系方式
- 列出的授权书?
- 电子文件还是硬拷贝文件?
- 授权号和生效日期范围
每个 GUI 都会要求用户选择一个或另一个,然后根据答案在模板中粘贴一段文本。
特殊指令的第一个 GUI 运行良好。但是脚本没有继续执行第二个 GUI,而是结束了。我使用 SciTE4 编辑器尝试查看发生了什么,在第一个 GUI 运行后,它跳到最后。
这是前两个 GUI 和结尾的代码:
;SPECIAL INSTRUCTIONS GUI
;Gui, Add, Text, W400 H40, Special instructions?
Gui, Add, Radio, vSpecInstrs Checked, Yes
Gui, Add, Radio, , No
Gui, Add, Edit, W370 r4 vListofInstrs,
Gui, Add, Button, vButtonNext1 gNextSelected1, Next
Gui, Add, Button, xp+60 vButtonCancel1 gCancelSelected1, Cancel
Gui, Show, W400 H150, Special Instructions?
return
;
NextSelected1:
Gui, Submit, ; Save the input from the user to each control's associated variable.
If SpecInstrs = 1
{
SendInput >{space 2}>{space 2}>{space 2}>{space 2}>{space 2}IMPORTANT{!}{space 2}<{space 2}<{space 2}<{space 2}<{space 2}<
Send {Enter 2}
SendInput %ListofInstrs%
Send {Enter 2}
}
Else If SpecInstrs = 2
{
Send {Enter 2}
}
SpecInstrs = 0
FileType =
Gui, Destroy
;Return
;
; Actions on Cancel or Close
;
CancelSelected1:
;GuiClose:
;ExitApp
gosub, GuiClose
;Return
;UPCOMING APPOINTMENTS GUI
Gui, Add, Text, Center W200 H50, UPCOMING APPOINTMENTS?
Gui, Add, Radio, vAppts checked, Yes
Gui, Add, Radio, , No
Gui, Add, Button, vButtonNext2 gNextSelected2, Next
Gui, Add, Button, xp+60 vButtonCancel2 gCancelSelected2, Cancel
Gui, Show, , Appointments
return
;
NextSelected2:
Gui, Submit, ; Save the input from the user to each control's associated variable.
If Appts = 1
{
SendInput >{space 2}>{space 2}>{space 2}>{space 2}>{space 2}Future Appointments - Do NOT Schedule On This Date{(}s{)}{space}<{space 2}<{space 2}<{space 2}<{space 2}<
Send {Enter 2}
SendInput {[}Copy and paste appointments from CPRS here{]}
Send {Enter 2}
SendInput >{space 2}>{space 2}>{space 2}>{space 2}>{space 2}<{space 2}<{space 2}<{space 2}<{space 2}<
Send {Enter 2}
}
Else If Appts = 2
{
Send Appointments pending: None
Send {Enter 2}
}
Gui, Destroy
Appts = 0
Return
;
; Actions on Cancel or Close
;
CancelSelected2:
gosub, GuiClose
;GuiClose:
;ExitApp
Return
代码实际上永远不会到达即将到来的约会 GUI。在运行调试器时,在我选择 Next 按钮后,它会跳到最后的代码:
;
;
GuiClose:
ExitApp
Return
我会粘贴其余的代码,但我想如果我能弄清楚如何让 GUI 2 在 GUI 1 之后运行,我可以让其他代码工作。 (此外,如果我什至无法运行 GUI 2,谁在乎其余的?!)。感谢您的帮助!
【问题讨论】:
-
NextSelected1之后的return(CancelSelected1之前)丢失/注释掉了,这意味着当你按下ButtonNext1时,gosub, GuiClose也会被执行 -
不幸的是,这没有帮助。我从 NextSelected1 部分的 Return 中删除了分号,但只有第一部分执行,无论我检查是(粘贴在模板的第一部分中)还是否(两个 Enter/CR 为下一步留出空间) .
-
请考虑更新问题startpost,这样我们才能真正重现您的问题。另外,代码之前已经过时了——在你的代码中,没有
GuiClose这样的标签,只是注释掉了3次 -
我只是将那些 GuiClose 的东西留在“以防万一”中,这些并不是我曾经认为的问题。简单地删除它们可能会更整洁。