private void HtmlHotKey_KeyPressed(object sender, KeyPressedEventArgs e) { CleanText cleanText = new CleanText(); // get the text and exit if no text on clipboard string htmlText = Clipboard.GetText(); if (string.IsNullOrEmpty(htmlText)) { return; } // put plain text on the clipboard Clipboard.SetText(cleanText.ToHtml(htmlText)); if (Preferences.Instance.PasteIntoActiveWindow) { // send CTRL+V for Paste to the active window or control _inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_V); } // play a sound if the user wa nts to on every paste if (Preferences.Instance.PlaySound) { SystemSounds.Asterisk.Play(); } }
void PlainHotKey_KeyPressed(object sender, KeyPressedEventArgs e) { CleanText cleanText = new CleanText(); // get the text and exit if no text on clipboard string plainText = Clipboard.GetText(); if (String.Empty.Equals(plainText)) { return; } // put plain text on the clipboard Clipboard.SetText(cleanText.ToPlain(plainText)); if (Preferences.Instance.PasteIntoActiveWindow) { // send CTRL+V for Paste to the active window or control InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_V); } // play a sound if the user wa nts to on every paste if (Preferences.Instance.PlaySound) { SystemSounds.Asterisk.Play(); } }