using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace AiAgent.Core.Infrastructure { public class GeminiRPA { [STAThread] public static string Query(string prompt) { string targetUrl = "https://aistudio.google.com/prompts/new_chat?prompt=" + Uri.EscapeDataString(prompt); Process.Start(new ProcessStartInfo(targetUrl) { UseShellExecute = true }); Thread.Sleep(3000); SendKeys.SendWait("^{ENTER}"); Thread.Sleep(7000); SendKeys.SendWait("+({TAB})"); Thread.Sleep(500); SendKeys.SendWait("+({TAB})"); Thread.Sleep(500); SendKeys.SendWait("+({TAB})"); Thread.Sleep(500); SendKeys.SendWait("{ENTER}"); Thread.Sleep(500); SendKeys.SendWait("{DOWN}"); Thread.Sleep(500); SendKeys.SendWait("{DOWN}"); Thread.Sleep(500); SendKeys.SendWait("{ENTER}"); Thread.Sleep(1500); var response = Clipboard.GetText(); Console.WriteLine("GeminiRPA response: " + response); Environment.Exit(0); return "GeminiRPA response to: " + prompt; } } }