Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ashfaaqrifath authored Jun 21, 2022
1 parent 6d1d78b commit 095f9e5
Show file tree
Hide file tree
Showing 10 changed files with 948 additions and 0 deletions.
46 changes: 46 additions & 0 deletions PC_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os
import winshell
import subprocess
import ctypes
import colorama
from speech_engine import casper_speak
from colorama import Fore, Back
colorama.init(autoreset=True)


def windows_tasks(command, voice_var):
if "change background" in command.lower():
ctypes.windll.user32.SystemParametersInfoW(
20, 0, "C:/Users/ashfa/Downloads/Wallpapers/dtwall11.png", 0)
print(Fore.GREEN + "Desktop background changed sir.".center(100))
casper_speak(speak="Desktop background changed sir.", voice=voice_var)

elif "clear" in command or "recycle" in command.lower():
winshell.recycle_bin().empty(confirm=False, show_progress=True, sound=True)
print(Fore.GREEN + "Recycle bin cleared sir.".center(100))
casper_speak(speak="Recycle bin cleared sir.", voice=voice_var)

elif "shutdown" in command.lower():
print(Fore.GREEN + "Windows will shutdown in T minus 60 seconds.".center(100))
casper_speak(
speak="Windows will shutdown in T minus 60 seconds.", voice=voice_var)
print(Fore.MAGENTA + "System power down, see you later sir.".center(100))
casper_speak(speak="System power down, see you later sir.", voice=voice_var)
os.system("shutdown /s /t 60")
os.system("taskkill /f /im python.exe")

elif "restart" in command.lower():
print(Fore.GREEN + "Restarting windows sir.".center(100))
casper_speak(speak="Restarting windows sir.", voice=voice_var)
print(Fore.MAGENTA + "System power down, see you later sir.".center(100))
casper_speak(speak="System power down, see you later sir.", voice=voice_var)
subprocess.call(["shutdown", "/r"])
os.system("taskkill /f /im python.exe")

elif "sign out" in command or "log off" in command.lower():
print(Fore.GREEN + "Windows signing out.".center(100))
casper_speak(speak="Windows signing out.", voice=voice_var)
print(Fore.MAGENTA + "System power down, see you later sir.".center(100))
casper_speak(speak="System power down, see you later sir.", voice=voice_var)
subprocess.call(["shutdown", "/l"])
os.system("taskkill /f /im python.exe")
22 changes: 22 additions & 0 deletions activity_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys
import os
import datetime

date = datetime.datetime.now().strftime("%h:%H:%M:%S")
log_name = str(date).replace(":", "-") + "-Log.txt"
folder = "Casper Log"
save_path = os.path.join(folder, log_name)


def casper_log(write):
print_save = sys.stdout
f = open(save_path, 'a', encoding="utf-8")
sys.stdout = f
y = write
y = write
y = write

print(y)

sys.stdout = print_save
f.close()
Loading

0 comments on commit 095f9e5

Please sign in to comment.