Input Simulation
OSL provides commands to simulate keyboard and mouse inputs at a system level.
Required Permission
Before using any simulation commands, you must request and receive the "simulate inputs" permission:
Keyboard Simulation
You can simulate keyboard input using the simulate "keypress"
command:
Mouse Simulation
OSL provides commands to simulate various mouse clicks at specific screen coordinates:
Important Notes
All coordinates are global screen coordinates, not window-relative
Mouse simulations work outside your application window
The permission must be granted before any simulation will work
Simulations happen at the system level
Use these commands responsibly to avoid unintended behavior
Best Practices
Always check if permission is granted before attempting simulations
Verify coordinates before simulating mouse clicks
Consider adding delays between simulations if needed
Handle cases where permission might be denied
Use simulations sparingly and only when necessary
Example Usage
Security Considerations
These commands can control the user's system
Always inform users about how simulations will be used
Request permission at an appropriate time
Handle permission denial gracefully
Consider providing alternative methods when permission is denied
Last updated
Was this helpful?