5 Feb 2019

VBScript magic : Make your computer greet you!

Using a small code snippet in VBScript we can make our computer talk to us or let’s just say greet us everytime our computer is turned on.

To make this happen follow the instruction:

  • Open any text editor and paste the code below and save it as “name.vbs”. Remember that the extension must be “.vbs” but the filename can be anything you want.

  • Copy the below given code into the file you just created.

    Set Sapi = Wscript.CreateObject("SAPI.SpVoice")

    dim str

    if hour(time) < 12 then

    Sapi.speak "Good Morning , Nice to see you. "

    else

    if hour(time) > 12 then

    if hour(time) > 16 then

    Sapi.speak "Good evening, Nice to see you."

    else

    Sapi.speak "Good afternoon, Nice to see you."

    end if

    end if

    end if

  • Goto C:\Users<your username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ and paste the above made “name.vbs” file here.

Now everytime you turn your computer on, it will greet you with different messsages according to the time.

Feel free to modify the code and configure this accordingly.


Tags:
0 comments