Introduction: Voice-controlled PC Assistant

About: Computer Science student in the UK
Ok so I know that there are a lot of these out there already, but I couldn't find a voice controlled PC assistant that I really liked, so I made my own. The assistant will do everything from tell jokes to opening programs, and I even coded a little script to help play the popular free game, Team Fortress 2. I have used a fantastic program called 'GlovePIE' to make her, which uses its own programming language. In this Instructable I will teach you how to install and use the assistant. You should learn enough just from looking at the code itself to be able to edit and write your own voice controlled assistants, but if you do want a separate instructable on how to code in GlovePIE just ask for it in the comments. 

Note that this is not an intelligent AI, you can't really hold a full conversation with it like you can with a bot like cleverbot. It only responds to what it is coded to do. I have coded simple conversations though, e.g. how are you, fine thanks etc. 

And yes, I did call it Jarvis, because it was inspired by the Iron Man film. Unfortunately, I don't think that there is a way to change to bot's voice from the default female voice, so we're stuck with a female Jarvis for now. 

A list of commands is on step 3


LOOK AT THIS:
How to control JARVIS, from your phone!! - instructables.com/id/Voice-control-your-PC-from-your-phone-android/
How to make JARVIS control videogames!! - instructables.com/id/Voice-control-games-using-GlovePIE/

Step 1: Preparation

1. First you need to install GlovePIE. This is simple enough, just go to this link:

http://glovepie.org/glovepie_download.php

(just click the link that says that you are 100% Green)

2. Once downloaded, extract the zip file into a folder called 'GlovePIE' on your desktop.

3. Double-click the file named 'PIEfree' to open GlovePIE

Next you need to download my code to use in GlovePIE. Just go to this link:

http://www.mediafire.com/view/vtzqb1vyc53gmm2/jarvis.PIE

Once downloaded, just drop it into your desktop

Step 2: Getting It to Work

Go back to GlovePIE and go to file>open, then navigate to your desktop and open the Jarvis.PIE file. 

Now all you have to do is click 'run' and you are good to go!

The next step will tell you how to use the assistant, and what she can do.

Step 3: Commands

Jarvis has two modes: listening and not listening. While Jarvis is not listening, you can say whatever you like and it will not respond to you (except for a few key words). When Jarvis is listening, it will be able to respond to you.

To get Jarvis to listen, say:
'Jarvis' or 'Hi Jarvis' or 'Hello Jarvis' or 'Jarvis listen'.

Once you have said this, Jarvis will continue to listen until you tell her to stop.

To get Jarvis to stop listening say:
'Thanks Jarvis' or 'Bye Jarvis' or 'thanks' or 'shut up'.



Commands you can say while Jarvis is not listening:

1. Toggle whether Jarvis listens or not - 
Explained above

2. Lock or unlock Jarvis - 
If you say 'lock' or 'I want you to respond to no one but me', Jarvis will shut down until she hears the password. Upon hearing the password, she will regain functionality. The default password is 'potato', you can change this in the code.

Commands when Jarvis is listening:

1. Show/hide the window - 
If you don't like having a window full of code open just say 'hide' to make it disappear. Say 'show to make it reappear.

2. Change your name - 
I have put 3 default names in, these are 'sir', 'sire', and 'overlord'. Say 'call me overlord' to make Jarvis address you as overlord. If you want a different name, you will have to put it in the code yourself. It's inconvenient, but its how GlovePIE works.

3. How are you - 
Say 'how are you' or 'how's it going' to chat with Jarvis

4. Type
Jarvis is not a dictation bot, so will not automatically type words from what you say, but she can type letters. Say 'start typing' to be able to type letters individually, and say 'stop typing' to stop Jarvis responding to individual letters. Say 'is typing enabled' to find out whether she is in typing mode or not.

5. Tell jokes
Jarvis has a bank of 10 or so cheesy jokes, just say 'tell me a joke' or 'say something funny' to hear a random joke.

6. Close window
Jarvis can 'Alt-f4' a window. Just say 'close window', then when she asks if you are sure you want to close it say 'yes'. (say 'no' to cancel)

7. Open programs
Jarvis can open programs and websites just say 'open chrome' for example.
List of default programs: notepad, google, ebay, facebook, youtube, gmail, spotify, steam, chrome, skype
In the next step I will explain how to change these programs.
Not all of these might work for you, as the programs might be in a different location on your PC. Again, I will explain how to fix this in the next step

8. Music
Just say 'play' or 'pause' to start and stop a music track

9. Alt-tab
Say 'cycle windows' to alt-tab. Say next to choose a different program, and say 'ok' or 'that one' to select it.

10, TF2 controls
If you play tf2, then I have coded a couple of controls here. Say 'enable tf2 control' to enable it. (and disable tf2 control' to disable it)
If you say 'medic', 'spy', or 'help' in game, then your character call out the corresponding phrase. Not a game-changer, but is a bit more convenient.

11. Screensaver
say 'sleep' to go into a screensaver, say 'wake up' to close the screensaver

12. Show desktop
Say 'show desktop' to show the desktop 





Step 4: Adding Your Own Programs

If you want to add or edit your own programs to the programs list, scroll down in GlovePIE until you see the following code:

if said("open [insert program]", 5) then
    say("opening [insert program]")
    Execute("[insert program path")
end if

Insert the name of your program into the 'insert program' square brackets. Finally, follow these steps to insert the program path:

1. Navigate to your program location, navigating to a shortcut is fine, for example, using a shortcut on your desktop is fine.
2. Right click on the icon 
3. Press properties
4. Copy (Ctrl+C) all the text inside the box called 'target' and paste it into the 'insert program path' section

It should look like this:

if said("open notepad", 5) then
    say("opening notepad")
    Execute("C:\Windows\system32\notepad.exe")
end if




Step 5: Final Notes

If you need an instructable on coding in GlovePIE then just comment below, but just looking at the code should give you enough information to get started.

If you happen to have displayfusion installed, you can say 'move window to the other screen' to switch screens.

Oh and if you have your speakers up too loud, Jarvis will hear herself and start having weird conversations with herself. 

I think that's everything. If you have any ideas about more features that could be added I would love to hear them!