is it possible to get python to write text in another program

1k views Asked by At

hi I made a text to speech app with a vbs script where I type the text and it will say what ever I typed.

I want to connect it to my python app where a user types tts 'text' it with say the text in the apostrophes here's a example I if I type

tts 'text'

is that possible? if it is possible how do you do it?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

I got it me and Rishav Kundu were in a chat room talking about and he give me the answer

the vbs script had this code

Dim msg, sapi
 msg=InputBox("Enter your text for text to speech")
 Set sapi=CreateObject("sapi.spvoice")
 sapi.Speak msg

changed it to this

Dim sapi
Set sapi=CreateObject("sapi.spvoice")

Set args = Wscript.Arguments
For Each arg In args
  sapi.Speak arg
Next

then in the python script I typed in this

from os import system
st = input().strip()
if st.index('tts') == 0:
        say = st[st.index("'"):]
        say = say.replace("'","")
        cmd = 'CSCRIPT <enter path to script here, forward slashes> '+ say
        system(cmd)