1
+ import os
2
+ import winshell
3
+ import subprocess
4
+ import ctypes
5
+ import colorama
6
+ from speech_engine import casper_speak
7
+ from colorama import Fore , Back
8
+ colorama .init (autoreset = True )
9
+
10
+
11
+ def windows_tasks (command , voice_var ):
12
+ if "change background" in command .lower ():
13
+ ctypes .windll .user32 .SystemParametersInfoW (
14
+ 20 , 0 , "C:/Users/ashfa/Downloads/Wallpapers/dtwall11.png" , 0 )
15
+ print (Fore .GREEN + "Desktop background changed sir." .center (100 ))
16
+ casper_speak (speak = "Desktop background changed sir." , voice = voice_var )
17
+
18
+ elif "clear" in command or "recycle" in command .lower ():
19
+ winshell .recycle_bin ().empty (confirm = False , show_progress = True , sound = True )
20
+ print (Fore .GREEN + "Recycle bin cleared sir." .center (100 ))
21
+ casper_speak (speak = "Recycle bin cleared sir." , voice = voice_var )
22
+
23
+ elif "shutdown" in command .lower ():
24
+ print (Fore .GREEN + "Windows will shutdown in T minus 60 seconds." .center (100 ))
25
+ casper_speak (
26
+ speak = "Windows will shutdown in T minus 60 seconds." , voice = voice_var )
27
+ print (Fore .MAGENTA + "System power down, see you later sir." .center (100 ))
28
+ casper_speak (speak = "System power down, see you later sir." , voice = voice_var )
29
+ os .system ("shutdown /s /t 60" )
30
+ os .system ("taskkill /f /im python.exe" )
31
+
32
+ elif "restart" in command .lower ():
33
+ print (Fore .GREEN + "Restarting windows sir." .center (100 ))
34
+ casper_speak (speak = "Restarting windows sir." , voice = voice_var )
35
+ print (Fore .MAGENTA + "System power down, see you later sir." .center (100 ))
36
+ casper_speak (speak = "System power down, see you later sir." , voice = voice_var )
37
+ subprocess .call (["shutdown" , "/r" ])
38
+ os .system ("taskkill /f /im python.exe" )
39
+
40
+ elif "sign out" in command or "log off" in command .lower ():
41
+ print (Fore .GREEN + "Windows signing out." .center (100 ))
42
+ casper_speak (speak = "Windows signing out." , voice = voice_var )
43
+ print (Fore .MAGENTA + "System power down, see you later sir." .center (100 ))
44
+ casper_speak (speak = "System power down, see you later sir." , voice = voice_var )
45
+ subprocess .call (["shutdown" , "/l" ])
46
+ os .system ("taskkill /f /im python.exe" )
0 commit comments