public Activity Create(System.Windows.DependencyObject target) { var fef = new GetElement(); var aa = new ActivityAction <NMElement>(); var da = new DelegateInArgument <NMElement>(); da.Name = "item"; fef.Body = aa; aa.Argument = da; return(fef); }
public bool ParseUserAction(ref IRecordEvent e) { if (e.UIElement == null) { return(false); } if (e.UIElement.ProcessId < 1) { return(false); } var p = System.Diagnostics.Process.GetProcessById(e.UIElement.ProcessId); if (p.ProcessName.ToLower() != "chrome" && p.ProcessName.ToLower() != "firefox") { return(false); } if (p.ProcessName.ToLower() == "chrome" && !NMHook.chromeconnected) { System.Windows.MessageBox.Show("You clicked inside Chrome, but it looks like you dont have the OpenRPA plugin installed"); return(false); } if (p.ProcessName.ToLower() == "firefox" && !NMHook.ffconnected) { System.Windows.MessageBox.Show("You clicked inside Firefix, but it looks like you dont have the OpenRPA plugin installed"); return(false); } if (LastElement == null) { return(false); } var selector = new NMSelector(LastElement, null, true, null); var a = new GetElement { DisplayName = LastElement.id + " " + LastElement.type + " " + LastElement.Name }; a.Selector = selector.ToString(); a.Image = LastElement.ImageString(); a.MaxResults = 1; e.Element = LastElement; e.Selector = selector; e.a = new GetElementResult(a); e.SupportInput = LastElement.SupportInput; e.SupportSelect = false; e.OffsetX = e.X - LastElement.Rectangle.X; e.OffsetY = e.Y - LastElement.Rectangle.Y; e.ClickHandled = false; //e.ClickHandled = true; //LastElement.Click(true, e.Button, e.X, e.Y, false, false); return(true); }
public Activity Create(System.Windows.DependencyObject target) { Type t = typeof(GetElement); var wfdesigner = Plugin.client.Window.LastDesigner; WFHelper.DynamicAssemblyMonitor(wfdesigner.WorkflowDesigner, t.Assembly.GetName().Name, t.Assembly, true); var fef = new GetElement(); var aa = new ActivityAction<NMElement>(); var da = new DelegateInArgument<NMElement>(); da.Name = "item"; fef.Body = aa; aa.Argument = da; return fef; }
private void OnMessage(NativeMessagingMessage message) { try { if (message.uiy > 0 && message.uix > 0 && message.uiwidth > 0 && message.uiheight > 0) { if (!string.IsNullOrEmpty(message.data)) { LastElement = new NMElement(message); } else { LastElement = new NMElement(message); } } if (message.functionName == "click") { if (IsRecording) { if (LastElement == null) { return; } var re = new RecordEvent { Button = Input.MouseButton.Left }; var a = new GetElement { DisplayName = LastElement.ToString() }; var selector = new NMSelector(LastElement, null, true, null); a.Selector = selector.ToString(); a.Image = LastElement.ImageString(); a.MaxResults = 1; re.Selector = selector; re.a = new GetElementResult(a); re.SupportInput = LastElement.SupportInput; re.SupportSelect = false; re.ClickHandled = true; OnUserAction?.Invoke(this, re); return; } } } catch (Exception ex) { Log.Error(ex.ToString()); } }
private void onMessage(NativeMessagingMessage message) { if (message.uiy > 0 && message.uix > 0 && message.uiwidth > 0 && message.uiheight > 0) { // Console.WriteLine("{0} {1},{2} {3},{4} - {5} ", message.functionName, message.uix, message.uiy, message.uiwidth, message.uiheight, message.xPath); if (!string.IsNullOrEmpty(message.data)) { lastElement = new NMElement(message); } else { lastElement = new NMElement(message); } } if (message.functionName == "click") { if (recording) { if (lastElement == null) { return; } var re = new RecordEvent(); re.Button = Input.MouseButton.Left; var a = new GetElement { DisplayName = lastElement.ToString() }; var selector = new NMSelector(lastElement, null, true); a.Selector = selector.ToString(); a.Image = lastElement.ImageString(); a.MaxResults = 1; re.Selector = selector; re.a = new GetElementResult(a); re.SupportInput = lastElement.SupportInput; re.ClickHandled = true; OnUserAction?.Invoke(this, re); return; } } }
public Activity Create(System.Windows.DependencyObject target) { Type t = typeof(GetElement); var wfdesigner = Plugin.client.Window.LastDesigner; WFHelper.DynamicAssemblyMonitor(wfdesigner.WorkflowDesigner, t.Assembly.GetName().Name, t.Assembly, true); var fef = new GetElement(); // fef.Variables = new System.Collections.ObjectModel.Collection<Variable>(); fef.Variables.Add(new Variable <int>("Index", 0)); fef.Variables.Add(new Variable <int>("Total", 0)); var aa = new ActivityAction <NMElement>(); var da = new DelegateInArgument <NMElement>(); da.Name = "item"; fef.Body = aa; aa.Argument = da; return(fef); }
public bool parseUserAction(ref IRecordEvent e) { if (lastElement == null) { return(false); } if (e.UIElement == null) { return(false); } if (e.UIElement.ProcessId < 1) { return(false); } var p = System.Diagnostics.Process.GetProcessById(e.UIElement.ProcessId); if (p.ProcessName.ToLower() != "chrome" && p.ProcessName.ToLower() != "firefox") { return(false); } var selector = new NMSelector(lastElement, null, true); var a = new GetElement { DisplayName = lastElement.id + " " + lastElement.type + " " + lastElement.Name }; a.Selector = selector.ToString(); a.Image = lastElement.ImageString(); a.MaxResults = 1; e.Element = lastElement; e.Selector = selector; e.a = new GetElementResult(a); e.SupportInput = lastElement.SupportInput; e.ClickHandled = true; e.OffsetX = e.X - lastElement.Rectangle.X; e.OffsetY = e.Y - lastElement.Rectangle.Y; lastElement.Click(true, e.Button, e.X, e.Y); return(true); }
public GetElementResult(GetElement activity) { Activity = activity; }
private void OnMessage(NativeMessagingMessage message) { try { //lock(_lock) //{ // //if (dpiscale == 0) // //{ // // dpiscale = NativeMethods.getScalingFactor(); // //} else // //{ // // dpiscale = NativeMethods.getScalingFactor(); // //} // var dpi = NativeMethods.GetDpiForSystem(); // dpiscale = 1; // if (dpi == 96) dpiscale = 1; // if (dpi == 120) dpiscale = 1.25f; // if (dpi == 144) dpiscale = 1.5f; // if (dpi == 192) dpiscale = 2; //} if (message.uiy > 0 && message.uix > 0 && message.uiwidth > 0 && message.uiheight > 0) { //message.uiy = (int)(message.uiy * dpiscale); //message.uix = (int)(message.uix * dpiscale); //message.uiwidth = (int)(message.uiwidth * dpiscale); //message.uiheight = (int)(message.uiheight * dpiscale); if (dpiscale == 1.25) { message.uiy += 158; } LastElement = new NMElement(message); } if (message.functionName == "click") { if (IsRecording) { if (LastElement == null) { return; } var re = new RecordEvent { Button = Input.MouseButton.Left }; var a = new GetElement { DisplayName = LastElement.ToString() }; message.tab = NMHook.tabs.Where(x => x.id == message.tabid && x.windowId == message.windowId).FirstOrDefault(); var selector = new NMSelector(LastElement, null, true, null); a.Selector = selector.ToString(); a.Image = LastElement.ImageString(); a.MaxResults = 1; re.Selector = selector; re.a = new GetElementResult(a); re.SupportInput = LastElement.SupportInput; re.SupportSelect = false; re.ClickHandled = true; OnUserAction?.Invoke(this, re); return; } } } catch (Exception ex) { Log.Error(ex.ToString()); } }
public bool ParseUserAction(ref IRecordEvent e) { if (e.UIElement == null) { return(false); } if (e.UIElement.ProcessId < 1) { return(false); } using (var p = System.Diagnostics.Process.GetProcessById(e.UIElement.ProcessId)) { if (p.ProcessName.ToLower() != "chrome" && p.ProcessName.ToLower() != "firefox" && p.ProcessName.ToLower() != "msedge") { return(false); } if (p.ProcessName.ToLower() == "chrome") { if (!NMHook.chromeconnected) { System.Windows.MessageBox.Show("You clicked inside Chrome, but it looks like you dont have the OpenRPA plugin installed"); return(false); } if (string.IsNullOrEmpty(e.UIElement.FrameworkId) || e.UIElement.FrameworkId.ToLower() != "chrome") { return(false); } } if (p.ProcessName.ToLower() == "msedge" && !NMHook.edgeconnected) { System.Windows.MessageBox.Show("You clicked inside Edge, but it looks like you dont have the OpenRPA plugin installed"); return(false); } if (p.ProcessName.ToLower() == "firefox" && !NMHook.ffconnected) { System.Windows.MessageBox.Show("You clicked inside Firefix, but it looks like you dont have the OpenRPA plugin installed"); return(false); } if (LastElement == null) { return(false); } if (LastElement.message == null) { return(false); } if (LastElement.message.tab == null) { LastElement.message.tab = NMHook.FindTabById(LastElement.message.browser, LastElement.message.tabid); } if (p.ProcessName.ToLower() == "chrome" || p.ProcessName.ToLower() == "msedge") { // if (e.UIElement.FrameworkId != "chrome" && e.UIElement.FrameworkId != "Chrome") return false; } } var selector = new NMSelector(LastElement, null, true, null); var a = new GetElement { DisplayName = LastElement.id + " " + LastElement.type + " " + LastElement.Name }; a.Variables.Add(new Variable <int>("Index", 0)); a.Variables.Add(new Variable <int>("Total", 0)); a.Selector = selector.ToString(); a.Image = LastElement.ImageString(); a.MaxResults = 1; e.Element = LastElement; e.Selector = selector; e.a = new GetElementResult(a); e.SupportInput = LastElement.SupportInput; e.SupportSelect = LastElement.tagname.ToLower() == "select"; e.OffsetX = e.X - LastElement.Rectangle.X; e.OffsetY = e.Y - LastElement.Rectangle.Y; e.ClickHandled = false; //e.ClickHandled = true; //LastElement.Click(true, e.Button, e.X, e.Y, false, false); return(true); }