-
Notifications
You must be signed in to change notification settings - Fork 1
/
typer.py
60 lines (56 loc) · 2.13 KB
/
typer.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
import copy
import os
import subprocess
import time
import random
import math
from pynput.keyboard import Key, Controller
keyboard=Controller()
#edit recursive!
def typer(text,cpm,error,replace_string,kb_use,use_caps,write_out,kb_original,disable_bp,lw):
sofar=""
if replace_string==' ' or replace_string==None:
replace_string='qwertyuiop[]asdfghjkl;zxcvbnm,./=´§ů,.-'
index=0
space_off='CTRL WIN ALT [ SPACE ] ALT OPT CTRL'
space_on='CTRL WIN ALT [_________] ALT OPT CTRL'
kb=copy.deepcopy(kb_original)
#print(kb_original)
def draw_ty(draw,ti):
for x in draw:
for y in x:
if ti.isupper(): print(y.upper(), end=' ')
else: print(y, end=' ')
print()
while index<len(text):
tindex=text[index]
if random.randint(0,100)==55 and error>0 and error<len(text)-len(sofar):
tindex=random.choice(replace_string)
elif error>len(text)-len(sofar):
tindex=random.choice(replace_string)
for z in kb:
if tindex.lower() in z:
ind=z.index(tindex.lower())
z[ind] = "█"
if kb_use==1: draw_ty(kb,tindex)
if tindex==' ' and kb_use==1 :print(space_on)
elif kb_use==1:print(space_off)
if write_out==1: print(sofar)
if tindex=="¦" and disable_bp==True:
keyboard.press(Key.backspace)
keyboard.release(Key.backspace)
elif tindex=="^" and disable_bp==True:
keyboard.press(Key.space)
keyboard.release(Key.space)
elif tindex=="¬" and disable_bp==True:
keyboard.press(Key.enter)
keyboard.release(Key.enter)
else:
keyboard.type(tindex)
kb=copy.deepcopy(kb_original)
sofar+=tindex
time.sleep(1/cpm)
if os.name=='nt': os.system('cls')
elif os.name=='posix': os.system('clear')
index+=1
if lw==True: typer(text,cpm,error,replace_string,kb_use,use_caps,write_out,kb_original,disable_bp,lw)