Introduction: Make an Assistant for Your Computer in 5 Minutes

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

Comments

author
Alen Biju (author)2017-08-02

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

author
Steets (author)2015-04-24

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?

author
Super_Nerd (author)Steets2015-04-24

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.

author
toremetal (author)Super_Nerd2017-01-09

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.

author
ValentinG23 (author)2016-06-03

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 ;)

author
Erodasii (author)2016-05-20

Could i get this to work on a phone?

author
Ani20100 (author)2016-04-29

No web page is opening....pls help

author
Ani20100 (author)2016-04-29

No web page is opening....pls help

author
Ani20100 (author)2016-04-29

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

author
johnson314 (author)2016-03-01

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.

author
Super_Nerd (author)johnson3142016-03-01

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.

author
skidish (author)2015-11-30

how can you ge tthis to run in a website

author
Super_Nerd (author)skidish2015-11-30

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

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

author
JainickV (author)2015-11-15

Thanks but could you specify where do we save those programs

author
Super_Nerd (author)JainickV2015-11-15

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.

author
JainickV (author)2015-11-14

What's winkey

author
Super_Nerd (author)JainickV2015-11-14

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.

author
OmarS23 (author)2015-09-08

Can i write this program in c++? And if so, can you give me example on it.

author
Super_Nerd (author)OmarS232015-09-08

Theoretically, yes as the structure will carry over into an if statement in C++, however I don't have the experience with C++ to actually write this program, since I'm unfamiliar with the syntax. The biggest problem you might face in converting this code would be finding an equivalent to SAPI. More information can probably be found though a quick Google search. Sorry I was unable to give a direct answer, but best of luck with the conversion.

author
OmarS23 (author)Super_Nerd2015-09-09

Thanks Super_Nerd

author
OmarS23 (author)2015-09-07

What is language you used for writing this code?

author
Super_Nerd (author)OmarS232015-09-07

VBS or Visual Basic Script.

author
HAX0RF7W23 (author)2015-07-27

Hey Super_Nerd

I am sort of new at VBScript and I can't quite determine what is wrong with my code, could you please help with it?

Thanks

-HAX0RF7W

Here it is

I added and changed the code a little so it is not the same as yours.

-----------------------------------------------------------------------------------------

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

dim Input

wshshell.run "%windir%\Speech\Common\sapisvr.exe -SpeechUX"
Sapi.speak "Hello, I am Name, Your assistant. What is your name?"

message=InputBox ("Hello, I am Name, what's your name?")
sapi.speak "Hello"
sapi.Speak message

sapi.speak "I can open Youtube, Instructables, Google, Command Prompt, Notepad, or Calculator for you"
sapi.speak "What would you like me to open?"
sapi.Speak message

do
message=inputbox ("What would you like me to open for you?")

if Input = "youtube" OR Input = "Youtube" OR Input = "Sandie open youtube" OR Input = "Open youtube" then
Sapi.speak "I am currently opening youtube for you"
wshshell.run "www.youtube.com"

else
if Input = "notepad" OR Input = "Notepad" OR Input = "Sandie open notepad" OR Input = "Open notepad"then
Sapi.speak "I am currently opening notepad for you"
wshshell.run "notepad"

else
if Input = "instructables" OR Input = "Instructables" OR Input = "Sandie open instructables" OR Input = "Open instructables" then
Sapi.speak "I am currently opening instructables for you"
wshshell.run "www.instructables.com"

else
if Input = "google" OR Input = "Google" Or Input ="Sandie open google" Or Input = "Open Google" then
Sapi.speak "I am currently opening google for you"
wshshell.run "www.google.com"

else
if Input = "command prompt" OR Input = "Command prompt" Or Input = "Sandie open command prompt" Or Input = "Open command prompt" Or Input = "cmd" Or Input = "CMD" Or Input = "Sandie open cmd" Or Input = "Open cmd" then
Sapi.speak "I am currently opening command prompt for you"
wshshell.run "cmd"

else
if Input = "calculator" OR Input = "Calculator" Or Input = "Sandie open calculator" Or Input = "Sandie open the calculator" Or Input = "Sandie open my calculator" Or Input = "Sandie open calc" Or input = "Open calculator" Or Input = "Open the calculator" Or Input = "Open calc" then
Sapi.speak "I am currently opening calculator for you"

else
if Input = "" then
else


Sapi.speak "I couldn't quite understand you Name, please repeat that."
end if
end if
end if
end if
end if
end if
end if

loop while 1<2

---------------------------------------------------------------------------------------------------

Thanks again, respond as soon as you can

no rush

author
Super_Nerd (author)HAX0RF7W232015-08-01

Could you please specify if this is an error that doesn't let your script run, or is this just your script not working properly. I'll get to testing this soon, but if you could tell me what I'm looking for that would be helpful. :)

author
b.JakeLegend.d (author)2015-05-04

Do any of you know the vbscript to get your computer to tell you the weather? What I mean by this is by the vbs fetching the weather forecast from yahoo weather or the weather channel, and then saying it using Sapi.speak?

author

Although I've never worked with it, I believe there is an HTTP API. You'd have to fetch the text of a web page and then using string functions parse it into the format you want. This may help:

http://stackoverflow.com/questions/204759/http-get-in-vbs

author
michaelpan (author)2015-03-10

how can i programming my assistant to turn on/off the wifi?

author
iane.tabor (author)2015-01-22

Hi Super_Nerd! This was the best! I am so excited going home from school everyday so just I can add more codes for my A.I. Thank you very much! But... I had one problem: I did what you told JoshuaS3 but it backfired. Maybe I did something wrong? Here check my codes:

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

dim Input

wshshell.run "%windir%\Speech\Common\sapisvr.exe -SpeechUX"
Sapi.speak "Greetings Ian, my name is Athos. I am going to be your personal assistant and I shall tend to all your needs. How may I help you?"
Input=inputbox ("Hello Iane! What can I do for you?")


do


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

loop

author
Super_Nerd (author)iane.tabor2015-01-22

Hi. I tested your program out. I kind of wished you told me what exactly happened. (although fighting with it myself was kind of funny) Your error was that you didn't put the inputbox in the loop. Looking back, the instructions in that comment were a little vague. Sorry for the confusion. I switched your code up to fix the issue and also make it more efficient. (I originally wrote this 3 years ago) Try copying this. If you select cancel or give it a blank input, it should abort from the program.

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

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

dim Input

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

Sapi.speak "Greetings Ian, my name is Athos. I am going to be your personal assistant and I shall tend to all your needs."

do

Sapi.speak "How may I help you?"

Input=inputbox ("Hello Iane! What can I do for you?")

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

Sapi.speak "Opening youtube"

wshshell.run "www.youtube.com"

elseif Input = "instructables" OR Input = "Instructables" then

Sapi.speak "Opening instructables"

wshshell.run "www.instructables.com"

elseif Input = "google" OR Input = "Google" then

Sapi.speak "Opening google"

wshshell.run "www.google.com"

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

Sapi.speak "Opening command prompt"

wshshell.run "cmd"

elseif Input = "calculator" OR Input = "Calculator" then

Sapi.speak "Opening calculator"

wshshell.run "calc"

elseif Input = "notepad" OR Input = "Notepad" then

Sapi.speak "Opening notepad"

wshshell.run "notepad"

elseif Input = "" then

Sapi.speak "Goodbye"

else

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

end if

loop until Input = ""

author
hegure_ryu (author)2015-01-09

This is great! Now I just need it to have it talk back and understand in JAVIS voice. I can live in nerd heaven, that and I need it to build me titanium flight suits.

author
Super_Nerd (author)hegure_ryu2015-01-09

Hmm, although I can't suggest how to make the computer respond like a human would, you could always have it attached to a 3d printer. Hehe.

author
JoshuaS3 (author)2014-08-20

I've got a question, after hitting enter the program disappears and starts your asked program/ webpage. But is it possible to let the program stay there so you can enter a new command?

author
Super_Nerd (author)JoshuaS32014-08-20

Yes. Just put a line with 'do' right before the first one that starts with Sapi.Speak. Then put a line with 'loop' at the very end of the program. I hope this helps.

author
ATI4890HD (author)2012-11-15

great.. I think I gonna edit the 'else' & 'endif' a lot to do my assistant work better

author
Super_Nerd (author)ATI4890HD2012-11-15

Great. Feel free to post your code up here.

author
BigMikeDog (author)2012-01-06

This is cool thanks for the info about the speech program on windows 7 im using right now i would suggest adding more programs to the personal assistant I added a Internet shortcut a game or two and a movie but still working on getting it to work it seems when it goes through the wshshell.run part it does not conect to the stuff i added and sugestions?

thanks bigmikedog :D

author
Super_Nerd (author)BigMikeDog2012-01-06

Did you make sure you had quotation marks around the shortcuts?

Tell me the error that you get.

author
BigMikeDog (author)Super_Nerd2012-01-06

here is the the code im useing 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, game for games, command prompt for cmd, site list for sitegoto, calculator for the calculator, notepad for notpad, log_me_out for shutdown options, or close to close the program")

if Input = "Site list" OR Input = "site list"then
Sapi.speak "loading site list"
wshshell.run "C:\Users\Michael\Desktop\bat games\sitegoto.bat"

else
if Input = "Game" OR Input = "game" then
Sapi.speak "loading game list"
wshshell.run "C:\Users\Michael\Desktop\bat games\games.bat"

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 = "log_me_out" OR Input = "log me out" then
Sapi.speak "starting log me out"
wshshell.run "C:\Users\Michael\Desktop\bat games\log-out.bat"

else
if Input = "close" then
Sapi.speak "Goodby Michael"

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

when i type in game it says the right thing but then it gives me this error mesage " line 17 chariter 1 (witch is the wshshell.run code bit) Error the system cannot find the file specified"
thanks -bigmikedog

author
Super_Nerd (author)BigMikeDog2012-02-07

Sorry it took so long to reply. Try just putting games.bat in the same folder assistant.vbs is in. Then instead of

C:\Users\Michael\Desktop\bat games\games.bat

put

games.bat

About This Instructable

65,996views

42favorites

License:

Bio: 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."
More by Super_Nerd:Make an assistant for your computer in 5 minutesTrack Computer Usage in 2.5 minutesHow to be a MAD Scientist! MU-AH HA HA HA!
Add instructable to: