Trying to find a way to simulate a keyboard input as seen here (c#) but in javascript:
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
// inputsim instance
public static InputSimulator inp_sim = new InputSimulator();
SetForegroundWindow(FindWindowByCaption(IntPtr.Zero, "Untitled - Notepad"));
inp_sim.Keyboard.KeyPress(VirtualKeyCode.VK_A);
Haven't been able to find a way to set keypress events to other windows in javascript so if anyone could point me in the right direction, would be much appreciated :)