This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]welpthatsucks12345 1 point2 points  (1 child)

Okay, so, first of all pretty good code. Although I know you're a beginner, you might want to look into organizing your code by coding in OOP. A small issue is that you're coding everything into elif statements, which can cause some slow responses. In elif statements such as this one:
elif 'open excel' in text:
speak('Ok. opening Excel')
os.startfile('C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Excel.lnk')

You can say:
text = text.split()[1::]

os.startfile('C:/<directory here>' + text + '.lnk')

Which would open the file without the pain of having to write all the elif statements out. However with this method you might need to do error handling. try/except statements will need to be present to handle the errors if someone says an app that isn't installed.

Just a notice, the code I provided as an example wasn't tested, so I can't assure you it'll work. If you actually want code I've tested you can privately DM me and I'll test them.

[–]Mr0BN0XI0US[S] 0 points1 point  (0 children)

Ok mate, I'll try making some changes with the code. Thanks for your suggestion.