B4J Question Simulate Key Press? (Send Key)

ilan

Expert
Licensed User
Longtime User
hi

is it possible with b4j to simulate a keyboard press outside the app. so if i press on a button in my app a virtual key press is simulated like if would have pressed the physical keyboard?

so the app should perform key presses even if it is not focused and the keypress should appear in whatever app is focused like notepad. is it possible?

thanx, ilan
 

ilan

Expert
Licensed User
Longtime User
You are better off using the jAWTRobot library than trying to mess with the AWTRobot API with JavaObject.

is it possible to simulate a key hold function?

i can do KeyPress and KeRelease but how to simulate a KeyHold?

thanx
 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
Holding a key down is just a failure to release the key in a timely fashion. You can have as long a delay as you want in between the press and release.

Note that the RobotDelay function is a blocking function.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…