static void Main_2() { bool isOpened = false; try { //Initializing mandatory parameters for application ConfigLibrary.Initialize(); SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_START, typeof(MainframeAutomation).Name); Initialize(); //isOpened = MainFrameAdapter.OpenPcomSessionAndConnect(); //Process p = Process.GetProcesses().SingleOrDefault(item => item.ProcessName == "pcsws"); // Process.GetProcessById("") Process p = Process.GetProcesses().SingleOrDefault(item => item.ProcessName == "filezilla"); System.Windows.Automation.AutomationElement t = WinFormAdapter.GetAEFromHandle(p.MainWindowHandle); //System.Windows.Automation.ControlType System.Windows.Automation.AutomationElement fdsfasdf = WinFormAdapter.GetAEOnChildByName(t, "ID_QUICKCONNECTBAR"); //System.Windows.Automation.AutomationElement fdsfasdf = WinFormAdapter.GetAEOnChildByName(t, "Servidor:"); WinFormAdapter.SetTextInTextArea(t, "fdsafsafasfdasfdsafdasfasfasdfasdfdsafsdafdasfdasfasd " + "\r\n" + "gfsdfdafs" + "\t" + "gadsfdad"); WinFormAdapter.SetTextInTextArea(t, "servidor" + "\t" + "usuario" + "\t" + "contraseña"); /*System.Windows.Automation.AutomationElement Servidor = WinFormAdapter.GetAEOnChildById(fdsfasdf, "-31800"); * System.Windows.Automation.AutomationElement Servidor1 = WinFormAdapter.GetAEOnChildById(fdsfasdf, "31801");*/ System.Windows.Automation.AutomationElement Servidor = WinFormAdapter.GetAEOnChildByName(fdsfasdf, ControlType.Edit, "Servidor:"); System.Windows.Automation.AutomationElement conexionRapida = WinFormAdapter.GetAEOnChildById(fdsfasdf, "-31925"); //System.Windows.Automation.AutomationElement conexionRapida = WinFormAdapter.GetAEOnChildByName(fdsfasdf, "Conexión rápida"); WinFormAdapter.SetText(Servidor, "hola"); //Point conexionRapida.GetClickablePoint(); WinFormAdapter.ClickElement(conexionRapida); //WinFormAdapter.SetText(WinFormAdapter.GetAEOnChildByName(fdsfasdf, "Conexión rápida"), "rrorro"); //System.Windows.Automation.AutomationElement t2 = WinFormAdapter.GetDialogBox(""); t.SetFocus(); //WinFormAdapter.SetText(t, "eeee"); WinFormAdapter.SetTextInTextArea(t, "fdsafsafasfdasfdsafdasfasfasdfasdfdsafsdafdasfdasfasd " + "\r\n" + "gfsdfdafs" + "\t" + "gadsfdad"); string texto = WinFormAdapter.GetText(t); //>> devuelve: //Microsoft Excel - Libro1 t.GetRuntimeId(); t.SetFocus(); System.Windows.Point punto = new System.Windows.Point(40, 40); System.Windows.Automation.AutomationElement xx = WinFormAdapter.GetAEFromBoundingRectangle(punto); string www = WinFormAdapter.GetText(xx); //WinFormAdapter.SetTextInTextArea(xx, "EFDSFSDAFSFDSAFASFA"); IntPtr e = WinFormAdapter.GetHandleForAE(t); const uint WM_KEYDOWN = 0x100; const uint KEYEVENTF_KEYUP = 0x0002; /*IntPtr result3 = SendMessage(WindowToFind, WM_KEYDOWN, ((IntPtr)k), (IntPtr)0);*/ SendMessage(e, WM_KEYDOWN, (IntPtr)Keys.Enter, (IntPtr)0); WinFormAdapter.SetWindowForeground(e); bool eeee = SetForegroundWindow(e); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero); //SendKeys.SendWait("EE"); //SendKeys.SendWait(Keys.Enter.ToString()); /*SendKeys.Send("K"); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString()); * SendKeys.Send(Keys.Enter.ToString());*/ Console.Write(www); MessageBox.Show(www); //System.Windows.Automation.AutomationElement t3 = WinFormAdapter.GetAEOnChildByName(t, ""); //WinFormAdapter.ClickElement(t2); /*System.Windows.Automation.AutomationElement t3 = WinFormAdapter.GetAE() * * WinFormAdapter.SetText(t2, "BFPJUARUI");*/ //Thread.Sleep(1000000); /*if (isOpened) * { * new BusinessLogic.BLIspfValidator().DoActivities(); * }**/ Thread.Sleep(10000900); } catch (TcsRpaException e) { SystemLog.LogErrorMessage(e, typeof(MainframeAutomation).Name, MethodBase.GetCurrentMethod().Name); } catch (Exception e) { SystemLog.LogErrorMessage(e, typeof(MainframeAutomation).Name, MethodBase.GetCurrentMethod().Name); } finally { if (isOpened) { MainFrameAdapter.ClosePCOM(); } } SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_END, typeof(MainframeAutomation).Name); Thread.Sleep(2000); }
static void Main() { bool isOpened = false; try { //Initializing mandatory parameters for application ConfigLibrary.Initialize(); SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_START, typeof(MainframeAutomation).Name); Initialize(); /*V1*/ /*isOpened = MainFrameAdapter.OpenPcomSessionAndConnect(); * * Process[] p = Process.GetProcessesByName("pcsws");*/ /* * System.Windows.Automation.AutomationElement t = WinFormAdapter.GetAEFromHandle(p[0].MainWindowHandle); * * System.Windows.Automation.AutomationElement t1 = WinFormAdapter.GetAEOnChildByName(t, "Inicio de sesión de IBM i"); * * * System.Windows.Automation.AutomationElement t2 = WinFormAdapter.GetAEOnChildByName(t, ControlType.Edit, "ID de usuario:"); * System.Windows.Automation.AutomationElement t2_1 = WinFormAdapter.GetAEOnChildById(t, ControlType.Edit,"1321"); * System.Windows.Automation.AutomationElement t2_2 = WinFormAdapter.GetAEOnDescByName(t, ControlType.Edit, "ID de usuario:"); * System.Windows.Automation.AutomationElement t2_3 = WinFormAdapter.GetAEOnDescByName(t, ControlType.Edit, "1321"); * * System.Windows.Automation.AutomationElement t3 = WinFormAdapter.GetAEOnChildByName(t, ControlType.Edit, "Contraseña:"); * * WinFormAdapter.SetText(t2, "BFPJUARUI"); * WinFormAdapter.SetText(t3, "BFPJUARUI2"); */ /* * if (isOpened) * { * new BusinessLogic.BLIspfValidator().DoActivities(); * }*/ new BusinessLogic.BLIsWebValidator().DoActivities(); //new BusinessLogic.BLIsDesktopValidator().DoActivities(); } catch (TcsRpaException e) { SystemLog.LogErrorMessage(e, typeof(CeseAutomation).Name, MethodBase.GetCurrentMethod().Name); } catch (Exception e) { SystemLog.LogErrorMessage(e, typeof(CeseAutomation).Name, MethodBase.GetCurrentMethod().Name); } finally { if (isOpened) { MainFrameAdapter.ClosePCOM(); } } SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_END, typeof(CeseAutomation).Name); Thread.Sleep(2000); }
public void ConfigureMenuOnlyServices(ServiceContext rootServiceContext) { ConfigLibrary configLibrary = new ConfigLibrary().BindServiceContext(rootServiceContext); configLibrary.LoadConfig(Resources.Load <TextAsset>("Config/config").text); }