One of my data entry scripts has multiple GUIs that prompt the user to answer a series of questions, and based on those answers, generates a template in Notepad to be copied and pasted into the Remarks section of a program to send appointment orders to a contractor.
Some of the GUIs I created have just a Yes and No radio button, but others have a Yes and No radio button along with a text box to enter additional data. For example, one GUI asks if there are upcoming appointments at our clinic. The default radio button is No so the user can quickly skip to the next GUI in the series, since the Next button at the bottom of the GUI is set as default.
- If the user leaves the No button as-is, at the end of "20 questions" as the script prints out the the template based on the answers, the script writes out "Upcoming appointments: None"
- If the user selects Yes and enters data in the respective text boxes, the template writes the "Upcoming Appointments" banner line, two {Enter} commands, the list of appointments, followed by two more {Enter} commands to leave space between Appointments and the following section.
Example:
If ApptsRadioButtonYes = 1
{
SendInput >{space 2}>{space 2}>{space}Future Appointments - Do NOT Schedule On This Date{(}s{)}{space}<{space 2}<{space 2}< ; Top-of-section banner line
Send {Enter 2}
Send %Appts_Info% ; list of appointments entered in text box
Send {Enter 2}
SendInput >{space 2}>{space 2}>{space 2}>{space}<{space 2}<{space 2}<{space 2}< ; End-of-section banner line
Send {Enter 3}
}
Else If ApptsRadioButtonNo = 1
{
Send Appointments pending: None
Send {Enter 3}
}
The flaw is, with the default set to No, if the user enters info in the text box but forgets to change the radio button to Yes, the script ignores any next-of-kin information or appointments info and prints out a line of text at the end of the script as ""Upcoming Appointments: None" or "NOK: None."
Conversely, if I set the default to Yes but the user did not enter anything in the text box, the script would print "NOK: " with nothing following. The same sort of thing happens with the upcoming appointments GUI, but a little more confusing: the script prints the "Upcoming Appointments" banner line, a blank line, another blank line (where there should have been an appointment), and two more {Enter}.
Is there a command I could use that would change the radio button to Yes if there is data in the text box, something along the lines of (in psuedo code):
If UserData is not blank
{
Set RadioButtonYes to 1
Set RadioButtonNo to 0
}
This way, if there is data and the user forgets to set the appropriate radio button to Yes, the presence of data in the text box takes care of the correct setting, and the appropriate heading plus the data is written.
Alternately, I could just change GUIs like that to just Yes/No, and if the answer is Yes, another GUI would pop up to get the data; if the answer is No, it would continue on to the next Yes/No GUI. I would rather keep the number of GUIs down to a manageable size and confined to one topic each. I could even just combine everything into one GUI, but that might get a little "busy."
Thanks!