Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 29f72b0

Browse files
authored
Merge pull request #210 from muskangoyal06/New_Awesome-Python-Scripts
Automating Various System Operations
2 parents fbd51da + 6f6c27b commit 29f72b0

File tree

2 files changed

+91
-34
lines changed

2 files changed

+91
-34
lines changed

Basic-Scripts/Menu_Driven.py

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
"""This code basically automates various system operations.
2+
It is a very interactive and user-friendly program
3+
The two modules used are os and pyttsx3."""
4+
5+
def system_operations():
6+
import pyttsx3
7+
import os
8+
pyttsx3.speak("Feel free to type in any statement!")
9+
while(True):
10+
11+
operation=input("Please type which operation you want to peform? :\n ")
12+
13+
print()
14+
operation= operation.lower()
15+
16+
if("chrome" in operation) or ("browser" in operation):
17+
pyttsx3.speak("Please wait opening chrome for you")
18+
os.system("chrome")
19+
20+
elif("notepad" in operation) or ("text editor" in operation) or ("text document" in operation):
21+
pyttsx3.speak("Please wait opening notepad for you")
22+
os.system("notepad")
23+
24+
elif("media player" in operation) or ("player" in operation) or ("windows media player" in operation):
25+
pyttsx3.speak("Please wait opening media player for you")
26+
os.system("wmplayer")
27+
28+
elif("visual studio code" in operation) or ("vs code" in operation) or ("vs" in operation):
29+
pyttsx3.speak("Please wait opening vs code for you")
30+
os.system("code")
31+
32+
elif("Git Hub" in operation) or ("github" in operation):
33+
pyttsx3.speak("Please wait opening github for you")
34+
os.system("GitHubDesktop")
35+
36+
elif("microsoft edge" in operation) or ("edge" in operation) or ("microsoft browser" in operation):
37+
pyttsx3.speak("Please wait opening microsoft edge for you")
38+
os.system("msedge")
39+
40+
elif("team viewer" in operation) or ("teamviewer" in operation):
41+
pyttsx3.speak("Please wait opening team viewer for you")
42+
os.system("TeamViewer")
43+
44+
elif("microsoft paint" in operation) or ("ms paint" in operation) or ("paint" in operation):
45+
pyttsx3.speak("Please wait opening microsoft edge for you")
46+
os.system("msedge")
47+
48+
elif("website" in operation) or ("link" in operation) or ("page" in operation) or ("chrome website" in operation) or ("chrome page" in operation):
49+
website=input("Enter the link for the website or page you want to open: \n")
50+
pyttsx3.speak("Please wait opening {} for you".format(website))
51+
os.system("chrome {}".format("website"))
52+
53+
elif("microsoft word" in operation) or ("ms word" in operation) or ("word" in operation):
54+
pyttsx3.speak("Please wait opening microsoft word for you")
55+
os.system("winword")
56+
57+
elif("exit" in operation) or ("return" in operation) or ("close" in operation) or ("end" in operation):
58+
pyttsx3.speak("Thank You! Hope to see you again")
59+
break
60+
61+
else:
62+
print("Error: Try some other operation available from the list!")
63+
pyttsx3.speak("Please enter some other operation")
64+
print()
65+
66+
def main():
67+
68+
import os
69+
import pyttsx3
70+
print()
71+
pyttsx3.speak("Welcome to the automation world")
72+
print(" This Is A Menu Drive Program ! ")
73+
print()
74+
print("Available Operations:")
75+
print("1) Open Chrome \n2) Open Notepad \n3) Open Media Player \n4) Open VS Code \n5) Open Git Hub \n6) Open any Website")
76+
print("7) Open Microsoft Edge \n8) Open Team Viewer(TeamViewer) \n9) Open MS Paint(mspaint) \n10) Open MS Word ")
77+
print()
78+
print("You can type a statement and interact!")
79+
print()
80+
81+
system_operations()
82+
83+
if __name__ == "__main__":
84+
main()

Basic-Scripts/Simple_calculator.py

+7-34
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,3 @@
1-
operation = input('''
2-
Please type in the math operation you would like to complete:
3-
1 for addition
4-
2 for subtraction
5-
3 for multiplication
6-
4 for division
7-
''')
8-
9-
num = int(input('Enter your first number: '))
10-
num2 = int(input('Enter your second number: '))
11-
12-
if operation == '1':
13-
print('{} + {} = '.format(num, num2))
14-
print(num+num2)
15-
16-
elif operation == '2':
17-
print('{} - {} = '.format(num, num2))
18-
print(num-num2)
19-
20-
elif operation == '3':
21-
print('{} * {} = '.format(num, num2))
22-
print(num*num2)
23-
24-
elif operation == '4':
25-
print('{} / {} = '.format(num, num2))
26-
print(num / num2)
27-
28-
else:
29-
print('Wrong Input! Please Try Again')
30-
=======
31-
32-
331
"""The previous script becomes very boring for the user as he has to keep on typing just numbers and of wants to interact using
342
simple english language he is unable to do so. Also the program terminates after one execution and if the user wants to keep on
353
performing operations it becomes difficult.
@@ -135,12 +103,17 @@ def main():
135103
print()
136104
print(" THIS IS A BASIC USER FRIENDLY CALCULATOR! ")
137105
print()
106+
107+
print("The allowed actions are:")
108+
print(" 1) ADDITION \n 2) SUBTRACTION \n 3) MULTIPLICATION \n 4) DIVISION")
109+
print()
138110
print("You can type a sentence and interact.")
139111
print()
112+
140113
#inputting two numbers at a time using the split function
141114
num_1,num_2 = input("Enter two numbers: ").split()
142-
num1=float(num_1)
143-
num2=float(num_2)
115+
num_1=float(num_1)
116+
num_2=float(num_2)
144117

145118

146119
#printing both the numbers

0 commit comments

Comments
 (0)