keyboard_key_press

With this function you can simulate the press of any key on the keyboard. When used, the key will be flagged as being pressed until the corresponding release function is called (see keyboard_key_release()). The function will take a keycode value as returned by the function ord() (only capital letters from A-Z or numbers from 0-9), or any of the vk_* constants listed on the main Keyboard Input page.

Note that after calling this function, if the key is physically pressed on the keyboard, this press event will not be registered again until the key has been physically released (triggering the release event and stopping this function), or the corresponding release key function has been called, and the key pressed again.

 

Syntax:

keyboard_key_press(key);

ArgumentType Description
keyVirtual Key Constant (vk_*) The key to simulate a press of.

 

Returns:

N/A

 

Example:

keyboard_key_press(vk_space);

This will simulate a spacebar press.