Skip to content

Instantly share code, notes, and snippets.

@theshuklz
Last active July 14, 2019 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theshuklz/7281054 to your computer and use it in GitHub Desktop.
Save theshuklz/7281054 to your computer and use it in GitHub Desktop.
prints out the key after a delay of 1 sec of running the file.
"""
This code simulates keyboard events using win32api library. you need to install win32api on ur windows machine to run it.
I made this program because I was asked to input the cd key every time I opened the game aoe3 asian dynasty.
HOW TO RUN
* double click aoe3y.exe
* make sure you save this file as .pyw so it runs in the background.
* change the delay if you want to. double click python file and within the delay click to textbox where to type key.
* watch it!
"""
import win32api,string,time
def pressKey(key_id):
win32api.keybd_event( key_id,0 )
key = "kdjmgpf9jbbyq3vh697qcwghc"
time.sleep(1)
for i in key:
time.sleep(0.01)
if(string.lowercase.find(i)!=-1): pressKey(string.lowercase.find(i)+65)
else: pressKey(int(i)+48)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment