随机字符串 - 通过代码复制和插入

Random string - Copy and insert through code

我正在努力让一些东西发挥作用... 我想将 value/string 传递给(我不知道英文名称...它是当您按 CTRL + C 时所选内容被复制的地方)然后 使用 CTRL-V 将其发布到网页上。

我有一个控制台应用程序生成 我想复制并粘贴到 Mozilla/Chrome 等网页上的随机字符串

从我的角度来看这可能吗? 如果是的话,有人可以告诉我方向吗?

你可以这样做 请务必添加对 System.Windows.Forms

的引用
using System.Linq;
using System.Threading;
using System.Windows.Forms;



    class Program
    {
        static void Main(string[] args)
        {
            Random random = new Random();
            const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            string myRandomSting = new string(Enumerable.Repeat(chars,   20).Select(s => s[random.Next(s.Length)]).ToArray());

            Thread thread = new Thread(() => Clipboard.SetText(myRandomSting));
            thread.SetApartmentState(ApartmentState.STA); //Set the thread to STA
            thread.Start();
            thread.Join();
        }
    }