-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
89 lines (71 loc) · 2.73 KB
/
app.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
# -----------------------------------------------------
# Kirima2nd Magic Copy
# -----------------------------------------------------
# Toggle and just copy your text and this code
# will replace your scrambled word with unscrambled one
#
# Thanks for tinmarr, stackoverflow, vegaseat, zx9 <3
#
# -----------------------------------------------------
import keyboard
import pyperclip
import asyncio
import worker
async def main():
toggleKeys = False
reversedKeys = False
print('----------------------------------')
print(' Kirima2nd Magic Copy ')
print('----------------------------------')
print(' ')
print('Keys List: ')
print(' * F4 - Toggle ON/OFF ')
print(' * F5 - Toggle Reversed ')
print(' * CTRL+C - To do the magic ')
print(' * F10 - Exit Application ')
print('----------------------------------')
while True:
if keyboard.is_pressed('f4'):
await asyncio.sleep(1.0)
if reversedKeys == True:
print('Disable Reversed Keys first!')
elif toggleKeys == False:
toggleKeys = True
print('[App]: Key Toggled: ON')
elif toggleKeys == True:
toggleKeys = False
print('[App]: Key Toggled: OFF')
pass
elif keyboard.is_pressed('f5'):
await asyncio.sleep(1.0)
if toggleKeys == True:
toggleKeys = False
if reversedKeys == False:
reversedKeys = True
print('[App]: Reversed Keys: ON')
elif reversedKeys == True:
reversedKeys = False
print('[App]: Reversed Keys: OFF')
pass
elif keyboard.is_pressed('ctrl+c') and toggleKeys:
await asyncio.sleep(1.0)
copy_word = pyperclip.paste()
if copy_word.count('_') < 2 or copy_word.count('?') < 2:
result = worker.Unscramble(copy_word)
else:
result = worker.Guess(copy_word)
pyperclip.copy(result)
print(f'[App]: Word unscrambled, the result is: {result}')
pass
elif keyboard.is_pressed('ctrl+c') and reversedKeys:
await asyncio.sleep(1.0)
copy_word = pyperclip.paste()
result = worker.Reverse(copy_word)
pyperclip.copy(result)
print(f'[App]: Word reversed, the result is: {result}')
pass
elif keyboard.is_pressed('f10'):
print('[App]: Exiting Application!')
break
if __name__ == "__main__":
asyncio.run(main())