I am trying to automate the process of generating a template to request medical exams from our outsourced provider. There are six GUIs in the script:
- Special Instructions
- List Upcoming Appointments
- Contact Information
- Power of Attorney Listed?
- Electronic or Hard-Copy File?
- Authorization Number and Effective Date Range
Each GUI asks the user to pick one choice or the other, and based on the answers, pastes a block of text in the template.
The first GUI for special instructions runs just fine. But instead of proceeding to the second GUI, the script ends. I used the SciTE4 editor to try to see what's going on, and after the first GUI runs, it skips to the very end.
Here's the code for the first two GUIs and the end:
;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
The code actually never gets to the Upcoming Appointments GUI. In running the debugger, after I select the Next button, it skips to the very end code:
;
;
GuiClose:
ExitApp
Return
I'd paste the rest of the code, but I figure if I can figure out how to make GUI 2 run after GUI 1, I can make the others work. (Besides, if I can't even get GUI 2 to run, who cares about the rest?!). I appreciate any help!
returnafterNextSelected1(beforeCancelSelected1) is missing / commented out, meaning that when you pressButtonNext1,gosub, GuiClosewill also be executed - phil294GuiClose, just commented out three times - phil294