File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ # JARVIS
2
+ Control windows programs with your voice.
Original file line number Diff line number Diff line change
1
+ __author__ = 'Mohammed Shokr <[email protected] >'
2
+ __version__ = 'v 0.1'
3
+
4
+ """
5
+ JARVIS:
6
+ - Control windows programs with your voice
7
+ """
8
+
9
+ # import modules
10
+ from datetime import datetime # datetime module supplies classes for manipulating dates and times
11
+ import subprocess # subprocess module allows you to spawn new processes
12
+
13
+ import speech_recognition as sr # speech_recognition Library for performing speech recognition with support for Google Speech Recognition, etc..
14
+
15
+
16
+
17
+ # obtain audio from the microphone
18
+ r = sr .Recognizer ()
19
+ with sr .Microphone () as source :
20
+ print ("Say something!" )
21
+ audio = r .listen (source )
22
+
23
+ # recognize speech using Google Speech Recognition
24
+ Query = r .recognize_google (audio )
25
+ print (Query )
26
+
27
+
28
+ # Run Application with Voice Command Function
29
+ def get_app (Q ):
30
+ if Q == "time" :
31
+ print (datetime .now ())
32
+ elif Q == "notepad" :
33
+ subprocess .call (['Notepad.exe' ])
34
+ elif Q == "calculator" :
35
+ subprocess .call (['calc.exe' ])
36
+ elif Q == "stikynot" :
37
+ subprocess .call (['StikyNot.exe' ])
38
+ elif Q == "shell" :
39
+ subprocess .call (['powershell.exe' ])
40
+ elif Q == "paint" :
41
+ subprocess .call (['mspaint.exe' ])
42
+ elif Q == "cmd" :
43
+ subprocess .call (['cmd.exe' ])
44
+ elif Q == "browser" :
45
+ subprocess .call (['C:\Program Files\Internet Explorer\iexplore.exe' ])
46
+ else :
47
+ print ("Sorry ! Try Again" )
48
+ return
49
+
50
+
51
+ # Call get_app(Query) Func.
52
+ get_app (Query )
You can’t perform that action at this time.
0 commit comments