-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (26 loc) · 699 Bytes
/
main.py
File metadata and controls
33 lines (26 loc) · 699 Bytes
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
from pynput.keyboard import Key, Listener
from pynput.keyboard import Controller
import json
# import logging
import pyperclip
# retrive json data
with open('things.json', 'r') as things:
x = json.load(things)
def Convert(string):
list1=[]
list1[:0]=string
return list1
let_text = ''
def on_press(key):
global let_text
let_text = str(let_text) + str(key)
let_text = let_text.replace("'", '')
#################################
for thing in x:
if thing in let_text:
clip = x[thing]
pyperclip.copy(clip)
pyperclip.paste()
let_text = ''
with Listener(on_press=on_press) as listener:
listener.join()