Wednesday, 25 September 2013

> How to make speak of your typed text in windows os by using Visual Basic Scripts

> Open Notepad.
> Copy the following VB script.
> Save it as (any name).vbs [Eg : audio.vbs ]

1. Dim msg, sapi
2. msg=InputBox("Enter your Text here to Speak it","Text-To-Audio  Converter")
3. Set sa=CreateObject ("sapi.spvoice")
4. sa.Speak msg

> How it Works?
> Create two variables for Dimentions i.e Dim [ used for declearing variables ]   
> Here i have Decleared two variables msg and sapi.
> To Display a Input Message Box use a method known InputBox("Here type your own content to      display","Here type the content to set as Title").
> Pass the typed text to a variable msg.
> Set an Object variable as sa and Create an Object "sapi.spvoice" ,here spvoice has been called by    variable sapi.
> Call Speak using an Object sa and pass Text holding value msg variable.
> Now itz completed.

Monday, 23 September 2013

> How to Open a Cd tray in Laptop using 3 lines of Visual Basic Scripts

 > Open Notepad.
 > Copy the Following VS code.
 > Save the File as (Any name).vbs format [ Eg:              open_cd_tray.vbs ]

1. Set creatingwscript = WScript.CreateObject("wscript.Shell")

2. Set play = CreateObject("WMPlayer.ocx")

3. play.cdromCollection.item(0).Eject()

 > How it Works ?
 > First create an Object using wscript as "wscript.Shell" as    parameter.
 > Set it with any Object name here i used creatingwscript.
 > And again create another one Object "WMPlayer.ocx".
 > Set another one Object name here i have used play.
 > Call the method [cdrom.Collection.item(0).Eject() using  play Object.
 > item(Here 0 is used because only one tray is present in  laptops).