I am experiencing strange behaviors when using some characters in my command. It looks like when I enter any character formed using the SHIFT, CTRL, ALT, WINDOWS key, I must manually reset those keys after each character, otherwise I get junk, other characters of nothing in some cases.
Here is an example, I attempt to run the script "C:\Temp\hello.bat":
Code: Select all
// Set focus to the WmWare Console windos
MyRepo.MyForm.MyScreen.Self.Click();
// Press the WINDOWS+R sequence to open the EXECUTE box in Windows
Keyboard.Down(System.Windows.Forms.Keys.LWin, Keyboard.DefaultScanCode, true);
Keyboard.Press(System.Windows.Forms.Keys.R, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
Keyboard.Up(System.Windows.Forms.Keys.LWin, Keyboard.DefaultScanCode, true);
// Enter command to execute
Delay.Milliseconds(500);
Keyboard.Press(Cmd);
Code: Select all
// Set focus to the WmWare Console windos
MyRepo.MyForm.MyScreen.Self.Click();
// Press the WINDOWS+R sequence to open the EXECUTE box in WIndows
Keyboard.Down(System.Windows.Forms.Keys.LWin, Keyboard.DefaultScanCode, true);
Keyboard.Press(System.Windows.Forms.Keys.R, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
Keyboard.Up(System.Windows.Forms.Keys.LWin, Keyboard.DefaultScanCode, true);
// Enter command to execute
Delay.Milliseconds(500);
for (int Pos=0; Pos<Cmd.Length; Pos++) {
Keyboard.Press(Cmd[Pos], false);
Keyboard.Up(System.Windows.Forms.Keys.ControlKey, Keyboard.DefaultScanCode, true);
Keyboard.Up(System.Windows.Forms.Keys.ShiftKey, Keyboard.DefaultScanCode, true);
Keyboard.Up(System.Windows.Forms.Keys.Alt, Keyboard.DefaultScanCode, true);
Keyboard.Up(System.Windows.Forms.Keys.LControlKey, Keyboard.DefaultScanCode, true);
Keyboard.Up(System.Windows.Forms.Keys.LShiftKey, Keyboard.DefaultScanCode, true);
Keyboard.Up(System.Windows.Forms.Keys.LWin, Keyboard.DefaultScanCode, true);
Keyboard.Up(System.Windows.Forms.Keys.RControlKey, Keyboard.DefaultScanCode, true);
Keyboard.Up(System.Windows.Forms.Keys.RShiftKey, Keyboard.DefaultScanCode, true);
Keyboard.Up(System.Windows.Forms.Keys.RWin, Keyboard.DefaultScanCode, true);
}