private void SendText(string text, int Down, int Interkey) { SetTarget(); //this example sends a simple 'Hello'. If you want to use other modifers or keys like 'SPACEBAR' or 'TAB' you'll need to tweak this code. //we will put each character in the key0 slot, wait a bit, clear the slot, wait a bit and then do the next letter int m; byte m1; byte k1; //iterate through the text. We'll send one character at a time for (var i = 0; i < text.Length; i++) { var t = text[i]; //check for uppercase letters if (t == char.ToUpper(t)) { m = KeyboardUtils.GetModifierKeyCode("[LSHIFT]"); } else { //no modifier needed m = -1; } //the modifier is represented by bit positions in a single byte //in this example we are allowing only one modifier to be pressed //but you could have something like a LALT-LSHIFT-A sequence which means //that you would need to set the bit for LALT, then OR that with LSHIFT to give a value of 6 //in this example, we are only handling [LSHIFT]. //calc the modifier switch (m) { case 0: m1 = 1; break; case 1: m1 = 2; break; case 2: m1 = 4; break; case 3: m1 = 8; break; case 4: m1 = 16; break; case 5: m1 = 32; break; case 6: m1 = 64; break; case 7: m1 = 128; break; default: m1 = 0; break; } //the keycode is the same whether it is capitalized or not k1 = KeyboardUtils.GetKeyKeyCode(char.ToLower(t).ToString()); if (k1 > 0) { //pressing the key down Send(m1, 0, k1, 0, 0, 0, 0, 0); //keep the key pressed for this many ms. System.Threading.Thread.Sleep(Down); //release the key KeyReset(); //wait before sending the next key System.Threading.Thread.Sleep(Interkey); } } }