What's happening, guys? In this tutorial, I am going to help you in creating a Text to Voice/Audio/Sound Converter in any text editor. For this tutorial, Notepad++ is recommended.
So, Let's Begin!
Steps:
1. Open any text editor that you've. If you have Notepad++, open it.
2. Then, type the following codes:
<html>
<head>
<title>Binit's Text to Voice Maker</title>
<HTA:APPLICATION
APPLICATIONNAME="Binit's Text to Voice Maker"
ID="Binit's Text to Voice Maker"
VERSION="1.0"
MAXIMIZEBUTTON="no"
SCROLL="no"/>
</head>
Here, we are creating the text to voice converter having extension .hta (HTA is a file extension for an HTML executable file format.). So, we used the tag <HTA:APPLICATION>.
3. After those codes, press Enter button and type the following codes:
<style> td { color: Black; }
caption { color: Black; }
body { font-family: Times New Roman; background-color: RED; color: WHITE; }
input { background-color: #202020; color: #808080; }
textarea { background-color: BLUE; color: WHITE; font-style:bold; }
</style>
The <style> tag is used to declare the stylesheets within your HTML document. It doesn't represent any contents in the application but it gives a design to the application. Since, we are creating a HTML executable file, we are using this tag.
4. After the above codes, type the following codes:
<script language="VBScript">
Sub Window_OnLoad
Dim width,height
width=512
height=512
self.ResizeTo width,height
End Sub
Function Listen
Dim message
message = tamsg.value
If (message = null) Then
X = MsgBox("Enter your message", 48, "Error Message")
Else
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak message
End If
End Function
</script>
Sub Window_OnLoad
Dim width,height
width=512
height=512
self.ResizeTo width,height
End Sub
Function Listen
Dim message
message = tamsg.value
If (message = null) Then
X = MsgBox("Enter your message", 48, "Error Message")
Else
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak message
End If
End Function
</script>
The <script> tag is used to define client-side script (VBScript) in this application. It is used in this application to define the height & width of the application and the 'Dim' statement is used to create variables & arrays in the application. It doesn't change the appearance of the application but it defines the tags & statements used to define the appearance of the application.
5. After the above codes, type the following codes:
<body bgcolor="white">
<table align="center" width="400">
<caption style="font-family:Book Antiqua; font-size:20;">
<hr color="black">
<b>Binit's Text to Voice Maker</b>
<hr color="black"></caption>
<tr>
<td align="center">
<span title="Enter your message here"><textarea id="tamsg" cols="50" rows="10"></textarea></span> </td> </tr>
<td align="right" color="black" style="font-family: Book Antiqua; font-size:18;">
<hr color="black">
<span title="Click here to listen your message">
<input style="width: 130px; height:25px; color: white; background-color: #203040; font-family:Book Antiqua; font-size:15;" type="button" Value="Listen the Voice" id="btnsp" onClick="Listen()" onmouseover="btnsp.style.background='#102030'" onmouseout="btnsp.style.background='#203040'">
</span>
</td> </tr> </table>
</body>
</html>
As the <body> tag defines the contents of the web page in HTML, here it defines the contents of the HTML Application. These tags define the contents & appearance of the application/program.
In the above program,
1. Text with Red Background: You can replace those texts with your own.
2. Text with Aqua Background: You can replace those texts with only the texts that are available. For example, in color name or color code, you can replace them with the color that is available. The same is for font-family. And, for 'no' text at the top of the code, you can replace them with only 'yes' text. For font-style, you can only replace the text with 'italic' or 'bold' or 'underline', etc.
3. Text with Blue Background: You can replace them but replacing them is not recommended because replacing can make the program look bad. It will work but its appearance may look bad.
After you type all these codes, save the file with an extension .hta. Otherwise, the application won't run. For example, save the file as 'Text to Voice.hta'. (without ' ')
Then, the program will run like this:
0 comments:
Post a Comment
Write Your Comments!