However the "NO" button doesn't work- clicking "NO" seems to run the YES script.
Code: Select all
RETURN_YES_OR_NO(text)
{global TheText, FirstName, LastName, OK, NO
GuiHWND = WinExist() ;--get handle to this gui..
Gui, +LastFound
Gui, Font, s18
Gui, Add , Button, Default x0 y40 gNO, NO
Gui, Add , Edit , vFirstName x+0 y40 w150,
Gui, Add , Edit , vLastName x+0 y40 w150,
Gui, Add , Button, Default x+0 y40 gOK, OK
Gui, Font, s20
Gui, Add, edit, +wrap w900 x0 y+20 vTheText, %text%
gui, show, , TITLE !!
text_to_speech(text)
WinWaitClose
OK:
GuiControlGet, Return_vFirstName, , FirstName
GuiControlGet, Return_vLastName, , LastName
if (Return_vFirstName="" && Return_vLastName="")
{msgbox, enter SOME data!
return
}
else if (Return_vFirstName="")
{msgbox, enter FIRST Name!
return
}
else
{GuiControlGet, ReturnText, , TheText
Gui, Destroy
returncode:=Return_vFirstName . " ## " . Return_vLastName . " ## " . ReturnText
return, returncode
}
return
NO:
Gui, Destroy
return, "no"
return
GuiEscape:
Gui, Destroy
return, "no"
return
}
What am I doing wrong?
If it's unclear what my goal is, here's instructions:
1. You're given data (%text%), & you have a chance to modify it.
2. If the data is nonsense you click "NO".
3. If the data is good you can enter a FirstName & LastName (but GUI will not allow you to continue if the FirstName is blank.)