Mouse and keyboard functions

i don’t know if this is possible, but can you simulate mouse clicks, moves and keyboard types with processing?
eg. a virtual keyboard/mouse controlled by the code?
say the mouse pointer was on the screen(win 10 desktop), can i move it with processing code?
then can i code it to lype a letter? outside of the processing window?

Many thanks