Hi,
Welcome to Microsoft Q&A!
You could try to use Windows.UI.Input.Preview.Injection
to simulate and automate user input from devices such as keyboard, mouse, touch, pen, and gamepad in your Windows applications.
Please note that input injection APIs require restricted capabilities. You will need to add inputInjectionBrokered as estricted capability in your manifest first.
<rescap:Capability Name="inputInjectionBrokered" />
For more details you could refer to the Doc: Simulate user input through input injection
Thank you
Jeanine