using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
// Macro checks if the clipboard contains text, then checks if the text
// contains whitespaces, then checks if no quotes are around text.
// If all conditions are fullfilled, it pastes the text surrounded
// by quotes (") into the active window.
//
// Notes: The clipboard is not changed. Existing quotes withing the text
// are not escaped.
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
if (BFS.Clipboard.HasText())
{
var rex = new Regex(@"\s");
if (rex.IsMatch(text))
{
string qtext = string.Empty;
if (!(text.StartsWith("\"") && text.EndsWith("\"")))
{
qtext = "\"" + text + "\"";
}
BFS.Clipboard.PasteText(qtext);
}
}
return text;
}
}