Hi, I am using a simulator software and while the simulation is running I need to provide some keyboard input. These are the steps:
1) I need to run the simulator first.
2) Wait for 60s.
3) Simulate the keypress "p" followed by "CTRL a" (press 'a' while holding Ctrl).
4) Then wait for 120s.
5) Finally close the window.
How do I code the above steps mentioned? The code I have at the moment (shown below) is for running the simulator software from C# console:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Text.RegularExpressions;
using System.Data;
using System.Windows.Input;
namespace examplescript
{
class Program
{
static void Main(string[] args)
{
// declare new process. This runs the simulator software (Flightgear) successfully
Process p1 = Process.Start("C:\\Users\\simulador\\test");
// sleep for 60s (This works successfully as well)
System.Threading.Thread.Sleep(60000);
// Simulate key press p
// Simulate key press Ctrl + a
// Wait for 120s
// close main window;
p1.CloseMainWindow();
}
}
}
SRA