static void Main() { DateTime start; CartesObj robot = new CartesObj(); Cartes.RPAWin32Component notepad; String workingFile; try { start = DateTime.Now; workingFile = Environment.CurrentDirectory; robot.open(workingFile + "\\library\\notepad.rpa"); notepad = robot.GetComponent <RPAWin32Component>("$NotePadEditor"); if (notepad.componentexist(0) == 0) { robot.run("notepad.exe"); notepad.waitforcomponent(30); } notepad.Value = WalkTree(0, notepad.Root());; notepad.focus(); robot.balloon("This example has opened the notepad and has presented you the component tree with its structure."); robot.RegisterIteration(start, "ok", "<task>Put your trace here in xml</task>", 1); robot.forensic("This is a trace for the swarm log, and the Windows event viewer."); MessageBox.Show("End"); } finally { robot.close(); } }
protected override CartesObj getCartes() { if (fCartes == null) { if ((CartesPath.Length > 0) && File.Exists(CartesPath)) { bool ok; string CartesName = Path.GetFileNameWithoutExtension(CartesPath); System.Diagnostics.Process current = System.Diagnostics.Process.GetCurrentProcess(); System.Diagnostics.Process[] ap = System.Diagnostics.Process.GetProcessesByName(CartesName); ok = false; foreach (System.Diagnostics.Process item in ap) { if (item.SessionId == current.SessionId) { ok = true; break; } } if (!ok) { System.Diagnostics.Process.Start(CartesPath); System.Threading.Thread.Sleep(3000); } fCartes = new CartesObj(); } else { throw new Exception("Cartes is not installed. Please install Robot Cartes from the RPA Suite installation."); } } return(fCartes); }
public MyCartesProcess(string csvAbortar) : base(csvAbortar) { fCartes = null; apis = new List <MyCartes>(); fFileSettings = null; fShowAbort = true; fVisibleMode = true; fSMTP = null; }
static void Main() { CartesObj cartes = new CartesObj(); RPADataString Abort; string workingFile; workingFile = Environment.CurrentDirectory; cartes.open(workingFile + "\\rpa\\AbortAndXML.rpa"); try { XmlDocument doc = new XmlDocument(); XmlNode usersNode = doc.CreateElement("users"); XMLFile datos2 = new XMLFile(); // Cartes class from CE_Data Abort = (RPADataString)cartes.component("$Abort"); Abort.ShowAbortDialog("Presss the button to end", "Bye", "Abort"); if (Abort.Value == "0") { XmlNode userNode = null; XmlNode phoneNode = null; // I create the XML with the native class of C # doc.AppendChild(usersNode); userNode = doc.CreateElement("name"); userNode.InnerText = "Federico Codd"; usersNode.AppendChild(userNode); phoneNode = doc.CreateElement("telephone"); phoneNode.InnerText = "985124753"; usersNode.AppendChild(phoneNode); phoneNode = doc.CreateElement("telephone"); phoneNode.InnerText = "654357951"; usersNode.AppendChild(phoneNode); // I create the XML with the Cartes class datos2.AsString["name"] = userNode.InnerText; datos2.getKey("telephone").listAsString[0] = "985124753"; datos2.getKey("telephone").listAsString[1] = "985124753"; do { Thread.Sleep(2000); }while (Abort.Value == "0"); doc.Save(workingFile + "\\datos1.xml"); datos2.SaveToFile(workingFile + "\\datos2.xml"); } } finally { cartes.close(); } }
public static T GetComponent <T>(this CartesObj cartesObj, string variablename) where T : class, IRPAComponent { IRPAComponent component = cartesObj.component(variablename); if (component == null) { return(null); } else if (component is T result) { return(result); } else { throw new Exception(variablename + " is a " + component.ActiveXClass()); } }
static void Main() { CartesObj robot = new CartesObj(); String primes; DateTime start; Cartes.RPAWin32Component notepad; String workingFile; String primesFile; try{ start = DateTime.Now; workingFile = Environment.CurrentDirectory; primesFile = workingFile + "\\primes.txt"; robot.open(workingFile + "\\library\\notepad.rpa"); robot.Execute("visualmode(true);"); primes = robot.Execute("LoadFromTxtFile(\"" + primesFile + "\");"); notepad = robot.GetComponent <RPAWin32Component>("$NotePadEditor"); if (notepad.componentexist(0) == 0) { robot.run("notepad.exe"); notepad.waitforcomponent(30); robot.reset(notepad.api()); /* "reset" warns Cartes of changes in * screen applications. Cartes reduces consumption of C.P.U. with * this notice. The A.I. of Cartes presupposes these opportune * notices in the source code. */ } notepad.Value = notepad.ActiveXClass() + "\r\n" + primes; notepad.focus(); robot.balloon("This example has opened the Notepad to write the first prime numbers."); robot.RegisterIteration(start, "ok", "<task>Put your trace here in xml</task>", 1); robot.forensic("This is a trace for the swarm log, and the Windows event viewer."); MessageBox.Show("End"); } finally{ robot.close(); } }