-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSystem.py
101 lines (63 loc) · 2.68 KB
/
System.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
from Automating import Keyboard
from os import system
import winsound
import socket
from getmac import get_mac_address
# from win10toast import ToastNotifier
import pyttsx3
import psutil
k = Keyboard()
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
# print(voices[0].id)
engine.setProperty('voice', voices[0].id)
engine.setProperty('rate', 120)
def speak(audio): # done
engine.say(audio)
engine.runAndWait()
def close():
k.multi_press(['alt', 'f4'])
def minisize(): # done
k.multi_press(['win', 'down'])
def minimize(): #done
k.multi_press(['win', 'down'])
k.multi_press(['win', 'down'])
def maxsize(): # done
k.multi_press(['win', 'up'])
def shutdown(minutes=0): # done
system(f"shutdown /s /t {minutes * 60}")
def restart(minutes=0): # done
system(f"shutdown /r /t {minutes * 60}")
def min_all(): # done
k.multi_press(['win', 'd'])
def change_working_window(): # done
k.multi_press(['alt', 'tab'])
def info(): # done
system("systeminfo")
def beep():
winsound.Beep(2500,500)
def IP(): # done
socket.gethostbyname(socket.gethostname())
def mac_address(): # done
return get_mac_address()
def cmd(command):
system(f'cmd /k {command}')
def notify(title,content,duration=20):
toast = ToastNotifier()
toast.show_toast(title, content, duration=duration)
def cpu_usage(): # done
usage = str(psutil.cpu_percent())
return usage
def bettery_left(): # done
usage = str(psutil.sensors_battery())
waste,percentage,time_left,pluged = usage.split('=')
percentage,w2 = percentage.split(',')
time_left,w2 = time_left.split(',')
pluged = pluged[0].lower()
if pluged == 't':
pluged = 'device is connected to power source'
else:
pluged = 'device is not connected to any power source'
return percentage+'% battery left'+', '+time_left+'second battery life is left'+' and '+pluged
if __name__ == '__main__':
speak('i have no problem check somewhere else !')