-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwork_with_word.py
110 lines (88 loc) · 2.68 KB
/
work_with_word.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
102
103
104
105
106
107
108
109
110
import j2
import keyboard
import jconfig
import time
def check_write_func():
voice = ""
x = True
def check_write(text):
if text == "прекратить запись":
x == False
return x
if text == "удалить все":
keyboard.press("ctrl")
keyboard.send("a")
keyboard.release("ctrl")
keyboard.send("backspace")
jconfig.WORD_MEMORY.clear()
if text == "удалить слово":
print("zxc")
count = len(jconfig.WORD_MEMORY[len(jconfig.WORD_MEMORY) - 1]) + 1
for i in range(count + 1):
keyboard.send("backspace")
for i, j in jconfig.COM_LIST_PUNCTUATION_COMMAND.items():
if i in text:
x = True
return x, j, i
else:
x = True
return x
while x == True:
print("запись продолжается")
qwerty = input()
time.sleep(2)
output = check_write(qwerty)
if type(output) == bool:
x = output
jconfig.WORD_COMMAND[2] = 0
else:
qwerty.replace(output[2], "")
x = output[0]
jconfig.WORD_COMMAND[1] = output[1]
jconfig.WORD_COMMAND[2] = output[2]
if jconfig.WORD_COMMAND[1] == "enter":
qwerty.replace("enter", "")
print(qwerty)
if not qwerty.split():
pass
else:
for i in qwerty.split():
jconfig.WORD_MEMORY.append(i)
if jconfig.WORD_COMMAND[1] == 0 and jconfig.WORD_COMMAND[0] != 1:
print("d")
keyboard.write(qwerty + " ")
else:
if jconfig.WORD_COMMAND[0] == 1:
print("a")
if jconfig.WORD_COMMAND[2] != 0:
print(jconfig.WORD_COMMAND)
if jconfig.WORD_COMMAND[1] == "enter":
keyboard.write((qwerty.replace(jconfig.WORD_COMMAND[2], "").replace(qwerty[0], qwerty[0].title()) + " "))
jconfig.WORD_COMMAND[0] = 1
else:
keyboard.write((qwerty.replace(jconfig.WORD_COMMAND[2], "").replace(qwerty[0], qwerty[0].title()) + " ") + jconfig.WORD_COMMAND[1])
jconfig.WORD_COMMAND[0] = 1
else:
try:
keyboard.write(qwerty.replace(jconfig.WORD_COMMAND[2], "").replace(qwerty[0], qwerty[0].title()))
except:
keyboard.write(qwerty.replace(qwerty[0], qwerty[0].title()))
jconfig.WORD_COMMAND[1] = 0
jconfig.WORD_COMMAND[0] = 0
elif jconfig.WORD_COMMAND[1] != 0:
print("s")
if jconfig.WORD_COMMAND[1] == "enter":
keyboard.write(qwerty.replace(jconfig.WORD_COMMAND[2], ""))
jconfig.WORD_COMMAND[0] = 1
else:
keyboard.write(qwerty.replace(jconfig.WORD_COMMAND[2], "") + jconfig.WORD_COMMAND[1])
jconfig.WORD_COMMAND[0] = 1
print(jconfig.WORD_COMMAND)
try:
if jconfig.WORD_COMMAND[1] == "enter":
keyboard.send("enter")
except:
pass
print(jconfig.WORD_MEMORY)
if __name__ == '__main__':
main()