static void Main() { DateTime start; RPAParameters parameters = new RPAParameters(); IRPAComponent notepad; RPAWin32Component editor; String workingFile, editorRoute; try { start = DateTime.Now; workingFile = Environment.CurrentDirectory; cartes.open(workingFile + "\\library\\notepad.rpa"); editor = cartes.GetComponent <RPAWin32Component>("$NotePadEditor"); if (editor.ComponentNotExist()) { cartes.run("notepad.exe"); editor.waitforcomponent(30); } editorRoute = editor.route(); notepad = editor.Root(); parameters.item[0] = WalkTree(0, notepad, ""); notepad.dochild(editorRoute, "TypeFromClipboard", parameters); editor.focus(); cartes.balloon("This example has opened the notepad and has presented you the component tree with its structure."); cartes.RegisterIteration(start, "ok", "<task>Put your trace here in xml</task>", 1); cartes.forensic("This is a trace for the swarm log, and the Windows event viewer."); MessageBox.Show("End"); } finally { cartes.close(); } }
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(); } }
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(); } }
static void Main() { DateTime start; RPAParameters parameters = new RPAParameters(), output = null; RPAWin32Component notepad = null, notepadclose = null, notepadeditor = null, notepadnosave = null, notepaddialog = null; String workingFile, language = "eng", imageCloseButton; start = DateTime.Now; workingFile = Environment.CurrentDirectory; imageCloseButton = workingFile + "\\closebutton.bmp"; cartes.open(workingFile + "\\library\\notepad2.rpa"); try { notepad = cartes.GetComponent <RPAWin32Component>("$Notepad"); notepadclose = cartes.GetComponent <RPAWin32Component>("$NotepadClose"); notepadeditor = cartes.GetComponent <RPAWin32Component>("$NotepadEditor"); notepadnosave = cartes.GetComponent <RPAWin32Component>("$NotepadNoSave"); notepaddialog = cartes.GetComponent <RPAWin32Component>("$NotepadDialog"); if (notepadeditor.componentexist(0) == 0) { cartes.run("notepad.exe"); notepadeditor.waitforcomponent(30); } notepad.ReSize(890, 600); notepad.Move(1, 5); notepad.focus(); notepad.SaveRectPartToFile(notepadclose.x - notepad.x, notepadclose.y - notepad.y, notepadclose.width, notepadclose.height, imageCloseButton); parameters.item[0] = imageCloseButton; output = notepad.FindPicture(parameters); if (output.item[0] == "1") { notepadeditor.TypeFromClipboard("RESULT : " + output.item[0] + "\r\n" + "X : " + output.item[1] + "\r\n" + "Y : " + output.item[2] + "\r\n" + "WIDTH : " + output.item[3] + "\r\n" + "HEIGHT : " + output.item[4] + "\r\n" + "INDEX : " + output.item[5] + "\r\n"); // I use the OCR directly on the screen with zoom MessageBox.Show(notepadeditor.RecognitionRatio(language, 1.3, 1)); // I use the OCR in an image file Thread.Sleep(2000); notepadeditor.focus(); notepadeditor.SaveRectToFile(imageCloseButton); cartes.Execute("$OCR = new OCR;\r\n" + "ShowMessage($OCR.run(\"" + imageCloseButton + "\", \"" + language + "\"));\r\n"); // Closing... notepad.clickon(int.Parse(output.item[1]) + int.Parse(output.item[3]) / 2, int.Parse(output.item[2]) + int.Parse(output.item[4]) / 2, 1); // I use the "ClickOn" function directly with the coordinates Thread.Sleep(1000); cartes.reset(notepadnosave.api()); notepadnosave.waitforcomponent(10); notepaddialog.SaveRectPartToFile(notepadnosave.x - notepaddialog.x, notepadnosave.y - notepaddialog.y, notepadnosave.width, notepadnosave.height, imageCloseButton); notepaddialog.ClickOnImage(true, imageCloseButton); } cartes.RegisterIteration(start, "ok", "<task>Put your trace here in xml for your swarm</task>", 1); cartes.forensic("This is a trace for the swarm log, and the Windows event viewer."); cartes.balloon("This example has opened the notepad and has shown how to use image recognition and OCR."); } finally { cartes.close(); MessageBox.Show("End"); } }