Writing a text file to HDD on Keydown key "A"
import ctypes #access Windows C functions
kernel32 = ctypes.windll.kernel32 #kernel level
user32 = ctypes.windll.user32 #user level
user32.ShowWindow(kernel32.GetConsoleWindow(), True) #showing console.. for now
key_pressed = user32.GetAsyncKeyState
while True:
if( key_pressed(65) & 1 ): #if A pressed:
file = open("hacks.txt","w")
file.write("hi there!")
file.close()
To display a file that has been written:
subprocess.run(['C:\\Windows\\Notepad.exe','hacks.txt'])