public static void PlayStringToFocusedWindow(string str) { var ks = new KeySequence(); foreach (char c in str) { if (char.IsUpper(c)) { ks.Down((Keys)c); } else if (char.IsLower(c)) { ks.Down(Keys.ShiftKey | ((Keys)(char.ToUpper(c)))); } ks.PlayToFocusedWindow(); ks.Clear(); } }
/// <summary> /// Convert an incoming key combination into an outgoing sequence of key presses. /// Doesn't currently work with IE. /// </summary> public void Macro(Keys[] incomingKeys, KeySequence outputKeys) { _bindings.Add(incomingKeys, outputKeys.PlayToFocusedWindow); }