belle_delphine.py
Active member
just a small script that reads the chatlog and when it detects a word that is in cuv_cap(type = Dictionary) it sets to clipboard the key/value..made in python 3..i was bored
@monday helped me with sum things <3
@monday helped me with sum things <3
Python:
import pyperclip, time, getpass
from os.path import getsize
from pathlib import Path
username = getpass.getuser()
path = Path('C:\\Users\\'+ username + '\\Documents\\GTA San Andreas User Files\\SAMP\\chatlog.txt')
if path.is_file():
print(path.is_file())
print(f"Heyy {username}")
else:
path = input('Chatlog directory path > ')
cuv_cap = {
'virgin' : 'me',
'Romania' : 'Bucuresti',
'gay' : 'user88',
'BMW' : 'i8',
'ugbase' : 'nothin'
}
custom_pref = input('custom prefix[blank = no prefix]: ')
def chatEntry(custom_pref):
if not custom_pref or custom_pref in ['no', 'nu', 'n'] :
return None
elif custom_pref:
return custom_pref
chatEntry(custom_pref)
def read_lines(path):
if getsize(path) > 0:
with open(path, 'r+') as chatlog:
for line in chatlog:
for cuv, cap in cuv_cap.items():
if cuv in line:
print(f"Key: [{cuv}] Value: [{cap}] --> PRINT{[cap]}")
print(line)
pyperclip.copy(chatEntry(custom_pref) + " " + cap)
pyperclip.paste()
chatlog.truncate(0)
if cap in line:
print(f"Value: [{cap}] Key: [{cuv}] --> PRINT{[cuv]}")
print(line)
pyperclip.copy(chatEntry(custom_pref) + " " + cuv)
pyperclip.paste()
chatlog.truncate(0)
while True:
try:
read_lines(path)
except PermissionError:
pass
except FileNotFoundError:
raise Exception("PathError: Path(chatlog.txt) is WRONG")
time.sleep(0.2)
Last edited: