Jump to content

Program to Hold down keys

Go to solution Solved by Guest,

Do you know Python? Writing a python script to hold down a key using winapi should be easy. Here is an exaple of a function that can do this:

def holdKeys(*keys):
    for i in keys: 			# for every argument provided
        win32api.keybd_event(i, 0,0,0) 	# press down the key provided
        time.sleep(0.05)		# wait for 0.05 seconds

holdKeyes(0x45, 0x46) # Hold keys with code 0x45 and 0x46 (e and f)

Find key codes here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Do you know Python? Writing a python script to hold down a key using winapi should be easy. Here is an exaple of a function that can do this:

def holdKeys(*keys):
    for i in keys: 			# for every argument provided
        win32api.keybd_event(i, 0,0,0) 	# press down the key provided
        time.sleep(0.05)		# wait for 0.05 seconds

holdKeyes(0x45, 0x46) # Hold keys with code 0x45 and 0x46 (e and f)

Find key codes here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×