Computer Hope
Software => Computer programming => Topic started by: progmer on May 11, 2010, 09:37:34 PM
-
Hi i have a vbs script as shown:
Dim message, sapi
Set sapi=CreateObject("sapi.spvoice")
do
message=InputBox("Enter the text you want spoken","Speak This")
sapi.Speak message
loop
I want to vbs box to keep on apearing on the screen but only exit when i press the cancel button.
So do anyone know the script?
-
Dim message, sapi
Set sapi=CreateObject("sapi.spvoice")
do
message=InputBox("Enter the text you want spoken","Speak This")
if message <> "" then sapi.Speak message
loop Until message=""
If you press cancel, Inputbox returns an empty string.
-
Dim message, sapi
Set sapi=CreateObject("sapi.spvoice")
do
message=InputBox("Enter the text you want spoken","Speak This")
if message <> "" then sapi.Speak message
loop Until message=""
If you press cancel, Inputbox returns an empty string.
Maybe you don't understand what i really want here.
"Press cancel to exit, Press ok to speak message."
-
That's exactly what it does. just change the Prompt of the InputBox.
-
Ok here is another task:
'Blank
x=msgbox("Do really wanted to run this program?",4096+64+4,"Confirm.")
'Blank
Dim message, sapi
Set sapi=CreateObject("sapi.spvoice")
do
message=InputBox("Enter the text you want spoken","Speak This")
if message <> "" then sapi.Speak message
loop until message= ""
What script should i add at the 'Blank in order to exit the program when i click no?
And i click yes to run the program?
-
If msgbox("Do really wanted to run this program?",4096+64+4,"Confirm.") = vbNo Then
WScript.Quit
End If
Dim message, sapi
Set sapi=CreateObject("sapi.spvoice")
do
message=InputBox("Enter the text you want spoken","Speak This")
if message <> "" then sapi.Speak message
loop until message= ""
For readability, try using using constant names (vbInformation, vbSystemModal) instead of constant values (64, 4096).
8)
-
If msgbox("Do really wanted to run this program?",4096+64+4,"Confirm.") = vbNo Then
WScript.Quit
End If
Dim message, sapi
Set sapi=CreateObject("sapi.spvoice")
do
message=InputBox("Enter the text you want spoken","Speak This")
if message <> "" then sapi.Speak message
loop until message= ""
For readability, try using using constant names (vbInformation, vbSystemModal) instead of constant values (64, 4096).
8)
Well thanks!! It works greate.
Here is my code:
Do
Dim message, sapi
Set sapi=CreateObject("sapi.spvoice")
If InputBox("Enter the text you want spoken","Speak This") = vbCancel then
wscript.quit
End if
sapi.Speak message
loop
My code is wrong and i hope you can help me with it.
-
Here is my code:
Do
Dim message, sapi
Set sapi=CreateObject("sapi.spvoice")
If InputBox("Enter the text you want spoken","Speak This") = vbCancel then
wscript.quit
End if
sapi.Speak message
loop
My code is wrong and i hope you can help me with it.
If you press cancel, Inputbox returns an empty string.
-
I hope anyone can help me with this......
press cancel, inputbox returns an empty string.
press the "x" button, the script exit.
This is actually what i want.
-
pressing "X" on the prompt window also causes the Inputbox() function to return an empty string.