Make an Assistant for Your Computer in 5 Minutes

71,427

43

42

Posted in TechnologyComputers

Introduction: Make an Assistant for Your Computer in 5 Minutes

About: I find a quote from Bill Gates makes a very good description. "Be nice to nerds. Chances are you'll end up working for one."

Heard of the new iPhone 4S with Siri? In under an hour I made one for windows in VBS. Now I can open youtube just by saying "youtube OK"
or search google by saying "google OK" Get prepared for making your own new form of using your computer.

You will need

-Windows Vista and up Machine (if you want voice activation. if not windows 98 or higher)
-5 minutes
-Microphone (If you want voice activation)

Step 1: Setup Speech Recognition

If you want to use speech recognition with this follow these instructions. If not, skip to step two.

Go to

Control Panel>Ease Of Access>Speech Recognition>Train your computer to better understand you

Follow the directions that it gives you and read the text aloud.

Step 2: Open Notepad

Press Winkey + R

Type in "notepad"

Hit enter

Step 3: Copy This Script Into Notepad (voice Activation)

Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
set wshshell = wscript.CreateObject("wscript.shell")

dim Input

wshshell.run "%windir%\Speech\Common\sapisvr.exe -SpeechUX"
Sapi.speak "Please speak, or type, what you want to open?"
Input=inputbox ("Please speak, or type, what you want to open.")





if Input = "youtube" OR Input = "Youtube"then
Sapi.speak "Opening youtube"
wshshell.run "www.youtube.com"

else
if Input = "instructables" OR Input = "Instructables" then
Sapi.speak "Opening instructables"
wshshell.run "www.instructables.com"

else
if Input = "google" OR Input = "Google" then
Sapi.speak "Opening google"
wshshell.run "www.google.com"

else
if Input = "command prompt" OR Input = "Command prompt" then
Sapi.speak "Opening command prompt"
wshshell.run "cmd"

else
if Input = "calculator" OR Input = "Calculator" then
Sapi.speak "Opening calculator"
wshshell.run "calc"

else
if Input = "notepad" OR Input = "Notepad" then
Sapi.speak "Opening notepad"
wshshell.run "notepad"

else
if Input = "" then
else


Sapi.speak "I don't recognize your input, Please try something else"
end if
end if
end if
end if
end if
end if
end if

Step 4: Copy This Script Into Notepad (no Voice Activation)

Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
set wshshell = wscript.CreateObject("wscript.shell")

dim Input

Sapi.speak "Please type, what you want to open?"
Input=inputbox ("Please type, what you want to open.")





if Input = "youtube" OR Input = "Youtube"then
Sapi.speak "Opening youtube"
wshshell.run "www.youtube.com"

else
if Input = "instructables" OR Input = "Instructables" then
Sapi.speak "Opening instructables"
wshshell.run "www.instructables.com"

else
if Input = "google" OR Input = "Google" then
Sapi.speak "Opening google"
wshshell.run "www.google.com"

else
if Input = "command prompt" OR Input = "Command prompt" then
Sapi.speak "Opening command prompt"
wshshell.run "cmd"

else
if Input = "calculator" OR Input = "Calculator" then
Sapi.speak "Opening calculator"
wshshell.run "calc"

else
if Input = "notepad" OR Input = "Notepad" then
Sapi.speak "Opening notepad"
wshshell.run "notepad"

else
if Input = "" then
else


Sapi.speak "I don't recognize your input, Please try something else"
end if
end if
end if
end if
end if
end if
end if

Step 5: Test the Script

Now save the script as assistant.vbs

Once the file has been saved run it, and it should tell you its ready for a command.

Say one of the options and then say OK.

It should open that option.

Step 6: Personalization

You can replace a chunk of code in here to open something else fairly easy. Lets start with one of the chunks, lets say, calculator.

else
if Input = "calculator" OR Input = "Calculator" then
Sapi.speak "Opening calculator"
wshshell.run "calc"

Say I want this to open bing.com

You have to change 4 parts.

else
if Input = "HERE" OR Input = "HERE" then
Sapi.speak "HERE"
wshshell.run "HERE"

The first one must be all lowercase. bing
The second one has a capital first letter Bing
The third is sapi speaking so something like Opening Bing
The fourth is the target www.bing.com


So it would look like this

else
if Input = "bing" OR Input = "Bing" then
Sapi.speak "Opening bing"
wshshell.run "www.bing.com"

!! Make sure everything has quotation marks around it or else it will be considered a variable not a text string!!

In case you were wondering why there was a capital and lowercase bing, it was so the program would recognize two common ways bing is written (with or without capitalization).



Step 7: Save and Test Again

Now that you have set the program to your liking, you can save it and run again. Test anything you set yourself to make sure it works. If it works move on. If it doesn't check your spelling or retry.  

Step 8: Yay!

Now that you have a shortcut program you can open youtube with two words. Get to google by speaking. This is very useful and fun to show to your friends. I don't want to see any comments saying "you could just use run" because you obviously didn't read through, since run doesn't automaticaly run sapi or speak after you open it. Anyways, thanks for reading.
                                                                                                                               
                                                                                                                             Super_Nerd

Share

    Recommendations

    • Spotless Contest

      Spotless Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Space Challenge

      Space Challenge
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    42 Comments

    My question my be silly(I am a 9th Grader).....How to run this program and will this work in Bluej Java .Please help me out. I typed like this in the notepad but i cannot run it

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

    set wshshell = wscript.CreateObject("wscript.shell")

    dim Input

    wshshell.run "%windir%\Speech\Common\sapisvr.exe -SpeechUX"

    Sapi.speak "Please speak, or type, what you want to open?"

    Input=inputbox ("Please speak, or type, what you want to open.")

    if Input = "youtube" OR Input = "Youtube"then

    Sapi.speak "Opening youtube"

    wshshell.run "www.youtube.com"

    else

    if Input = "instructables" OR Input = "Instructables" then

    Sapi.speak "Opening instructables"

    wshshell.run "www.instructables.com"

    else

    if Input = "google" OR Input = "Google" then

    Sapi.speak "Opening google"

    wshshell.run "www.google.com"

    else

    if Input = "command prompt" OR Input = "Command prompt" then

    Sapi.speak "Opening command prompt"

    wshshell.run "cmd"

    else

    if Input = "calculator" OR Input = "Calculator" then

    Sapi.speak "Opening calculator"

    wshshell.run "calc"

    else

    if Input = "notepad" OR Input = "Notepad" then

    Sapi.speak "Opening notepad"

    wshshell.run "notepad"

    else

    if Input = "" then

    else

    Sapi.speak "I don't recognize your input, Please try something else"

    end if

    end if

    end if

    end if

    end if

    end if

    end if

    1 reply

    Hi,

    I m Pritesh Singh and i m also a student(Studying in 10 in ICSE bord ). According to me, BlueJ is not a powerful application to run java it has many drawbacks. If you want to create a powerful A.I you need to use Eclipse(it is a powerful application to run java)

    Is there a way to have my computer sleep, restart, shut down, or even close browsers or other windows from the same command? also is there a way to loop it so i dont have to keep opening the assistant?

    I would justlike to ask to me: is there a way to give it conversational abilities? For example:
    Context:
    Computer: Shall I open youtube?
    Person: yes.
    Computer: Ok.I will open youtube.

    Context:
    Computer:Want me to check the weather?
    Person: Yes.
    Computer:Ok.I will open youtube.

    The actual question: Can I have EdEN (Thats what I call mine) say different things based on their context?

    3 replies

    Although giving such a system conversational and contextual intelligence would be extremely difficult and complicated, it's certainly not impossible. I would certainly plan out exactly how you want EdEN to parse sentences because it's unrealistic to assume you can just make AI. I'd suggest using some of the VBS string features to search what the user says for key words and then go on from there. Please reply if I didn't quite answer your question.

    Actually its Not I wrote one You teach as you go the more you interact the greater the conversational ability making its response decisions based on a mood degree deterimined by the interaction with it. you teach it what to say by whats being said to it and whether its good or bad. just like a child.

    You want to create a form of Artificial Intelligence (AI). Good luck.

    If some of you are interested in coding their ows personal assistant, here an example of a program I made using Python:

    https://github.com/Valenti.../Jarvis-artificial-intelligence

    It is coded in a structured way so that you can easily understaind and modify the code for your own needs, you need basic python knowledge.
    Hoping that will help someone ;)

    Could i get this to work on a phone?

    No web page is opening....pls help

    No web page is opening....pls help

    how do i open a game with this.When i try to do that an error appears which tells that 'THE SYSTEM CANNOT FIND THE FILE SPECIFIED'.I am running windows xp

    how would you make the system automatically accept a command if it is a known command. With it the way it is now, you say the command, but then have to hit enter. I want to be able to say google and it process it right away without hitting enter.

    1 reply

    Saying "ok" can also advance the script if I recall correctly. You may also be able to look into an API for speech recognition in visual basic script. Back when I wrote this, I wasn't aware of that option, but if I were to try and rewrite this, I would probably use the API. In short, there isn't an easy way that comes to mind to solve your issue, but more advanced methods might be able to.

    how can you ge tthis to run in a website

    1 reply

    You would probably want to do something similar to what's described here.

    http://www.csidata.com/custserv/onlinehelp/vbsdocs/vbs9.htm

    Thanks but could you specify where do we save those programs

    1 reply

    Since this script doesn't need anything else to run in it's original state, it doesn't need to be saved anywhere specifically. Just save it where it's easily accessible for the sake of convenience.

    The key with the windows logo on it. If you're still having trouble opening notepad, you can usually just search it in the start menu.