Skip to content

Commit a2434e5

Browse files
committed
Added Job_Click and updated Job_Value
Increased the level of passive logging on activities, you are now notified when an activity starts and when an activity ends.
1 parent bdd0a3d commit a2434e5

File tree

4 files changed

+147
-23
lines changed

4 files changed

+147
-23
lines changed
Binary file not shown.
Binary file not shown.

.vs/UiPath.CodeBase/v17/.suo

-7 KB
Binary file not shown.

UiPath.Core.CodeActivities/UiPathCodeWorks.cs

Lines changed: 147 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Generic;
55
using UiPath.Core;
66
using UiPath.Core.Activities;
7+
using UiPath.UIAutomationNext.Enums;
78

89
namespace Inscriber
910
{
@@ -19,55 +20,178 @@ public class Job_GetValue : Activity
1920
public IDictionary<string, object> Run(
2021
WaitForReady waitForReady = WaitForReady.NONE,
2122
string Selector = null,
22-
UiElement uiElement = null,
23+
UiElement UiElement = null,
2324
int TimeOut = 30,
2425
bool ContinueOnError = false
2526
)
2627
{
28+
29+
//Assigning values and initializing dictionary
2730
WaitForReadyArgument = waitForReady;
2831
SelectorArgument = Selector;
2932
TimeoutArgument = TimeOut;
3033
ValueArgument = new OutArgument<string>();
3134
ContineOnErrorArgument = ContinueOnError;
3235

36+
IDictionary<string, object> output = new Dictionary<string, object>();
37+
input.Add(nameof(WaitForReadyArgument), waitForReady);
38+
input.Add(nameof(SelectorArgument), Selector);
39+
input.Add(nameof(TimeoutArgument), TimeOut);
40+
input.Add(nameof(ContineOnErrorArgument), ContinueOnError);
3341

34-
if (Selector == null && uiElement != null)
35-
SelectorArgument = uiElement.Selector.ToString();
36-
else if (Selector == null && uiElement == null)
42+
if (Selector == null && UiElement != null)
43+
SelectorArgument = UiElement.Selector.ToString();
44+
else if (Selector == null && UiElement == null)
3745
throw new SystemException("No Selector or uiElement parameter provided.");
3846

3947
Implementation = () => new Sequence
4048
{
4149
Activities =
50+
{
51+
new GetValue
4252
{
43-
new GetValue
53+
Target = new Target
4454
{
45-
Target = new Target
46-
{
47-
WaitForReady = new InArgument<WaitForReady>(activityContext =>
48-
WaitForReadyArgument.Get(activityContext)),
49-
Selector = new InArgument<string>(activityContext =>
50-
SelectorArgument.Get(activityContext)),
51-
TimeoutMS = new InArgument<int>(activityContext =>
52-
TimeoutArgument.Get(activityContext))
53-
},
54-
ContinueOnError = new InArgument<bool>(activityContext =>
55-
ContineOnErrorArgument.Get(activityContext)),
56-
Value = new OutArgument<string>(activityContext =>
57-
ValueArgument.Get(activityContext))
58-
}
55+
WaitForReady = new InArgument<WaitForReady>(activityContext =>
56+
WaitForReadyArgument.Get(activityContext)),
57+
Selector = new InArgument<string>(activityContext =>
58+
SelectorArgument.Get(activityContext)),
59+
TimeoutMS = new InArgument<int>(activityContext =>
60+
TimeoutArgument.Get(activityContext))
61+
},
62+
ContinueOnError = new InArgument<bool>(activityContext =>
63+
ContineOnErrorArgument.Get(activityContext)),
64+
Value = new OutArgument<string>(activityContext =>
65+
ValueArgument.Get(activityContext))
5966
}
67+
}
6068
};
6169

62-
input.Add(nameof(WaitForReadyArgument), waitForReady);
63-
input.Add(nameof(SelectorArgument), Selector);
64-
input.Add(nameof(TimeoutArgument), TimeOut);
65-
input.Add(nameof(ContineOnErrorArgument), ContinueOnError);
70+
71+
try
72+
{
73+
Console.WriteLine("");
74+
Console.WriteLine("Starting Get Text activity");
75+
output = WorkflowInvoker.Invoke(this, input);
76+
Console.WriteLine("");
77+
Console.WriteLine("Finished Get Text activity.");
78+
}
79+
catch (Exception e)
80+
{
81+
Console.WriteLine(e);
82+
Console.WriteLine("");
83+
Console.WriteLine("");
84+
Console.WriteLine("Press any key to continue or to exit...");
85+
Console.ReadLine();
86+
}
87+
88+
return output;
89+
}
90+
}
91+
92+
public class Job_Click : Activity
93+
{
94+
public IDictionary<string, object> input = new Dictionary<string, object>();
95+
public InArgument<Boolean> ContinueOnErrorArgument { get; set; }
96+
public InArgument<int> DelayAfterArgument { get; set; }
97+
public InArgument<int> DelayBeforeArgument { get; set; }
98+
public InArgument<ClickType> ClickTypeArgument { get; set; }
99+
public InArgument<MouseButton> MouseButtonArgument { get; set; }
100+
public InArgument<UiElement> UiElementArgument { get; set; }
101+
public InArgument<String> SelectorArgument { get; set; }
102+
public InArgument<int> TimeoutMSArgument { get; set; }
103+
public InArgument<WaitForReady> WaitForReadyArgument { get; set; }
104+
public InArgument<CursorMotionType> CursorMotionTypeArgument { get; set; }
105+
public InArgument<KeyModifiers> KeyModifiersArgument { get; set; }
106+
public InArgument<bool> SendWindowMessagesArgument { get; set; }
107+
public InArgument<bool> SimulateClickArgument { get; set; }
108+
109+
public IDictionary<string, object> Run(
110+
bool ContinueOnError = false,
111+
int DelayAfter = 300,
112+
int DelayBefore = 200,
113+
ClickType ClickType = ClickType.CLICK_SINGLE,
114+
MouseButton MouseButton = MouseButton.BTN_LEFT,
115+
String Selector = null,
116+
UiElement UiElement = null,
117+
int TimeOutMS = 3000,
118+
WaitForReady WaitForReady = WaitForReady.NONE,
119+
CursorMotionType CursorMotionType = CursorMotionType.Instant,
120+
KeyModifiers KeyModifiers = KeyModifiers.None,
121+
bool SendWindowMessages = false,
122+
bool SimulateClick = false
123+
)
124+
{
125+
//Assigning values and initializing dictionary
126+
ContinueOnErrorArgument = ContinueOnError;
127+
DelayAfterArgument = DelayAfter;
128+
DelayBeforeArgument = DelayBefore;
129+
ClickTypeArgument = ClickType;
130+
MouseButtonArgument = MouseButton;
131+
UiElementArgument = UiElement;
132+
SelectorArgument = Selector;
133+
TimeoutMSArgument = TimeOutMS;
134+
WaitForReadyArgument = WaitForReady;
135+
CursorMotionTypeArgument = CursorMotionType;
136+
KeyModifiersArgument = KeyModifiers;
137+
SendWindowMessagesArgument = SendWindowMessages;
138+
SimulateClickArgument = SimulateClick;
66139

67140
IDictionary<string, object> output = new Dictionary<string, object>();
141+
input.Add(nameof(ContinueOnErrorArgument), ContinueOnError);
142+
input.Add(nameof(DelayAfterArgument), DelayAfter);
143+
input.Add(nameof(DelayBeforeArgument), DelayBefore);
144+
input.Add(nameof(ClickTypeArgument), ClickType);
145+
input.Add(nameof(MouseButtonArgument), MouseButton);
146+
input.Add(nameof(SelectorArgument), Selector);
147+
input.Add(nameof(TimeoutMSArgument), TimeOutMS);
148+
input.Add(nameof(WaitForReadyArgument), WaitForReady);
149+
input.Add(nameof(CursorMotionTypeArgument), CursorMotionType);
150+
input.Add(nameof(KeyModifiersArgument), KeyModifiers);
151+
input.Add(nameof(SendWindowMessagesArgument), SendWindowMessages);
152+
input.Add(nameof(SimulateClickArgument), SimulateClick);
153+
154+
155+
if (Selector == null && UiElement != null)
156+
SelectorArgument = UiElement.Selector.ToString();
157+
else if (Selector == null && UiElement == null)
158+
throw new SystemException("No Selector or uiElement parameter provided.");
159+
160+
Implementation = () => new Sequence
161+
{
162+
Activities =
163+
{
164+
new Click()
165+
{
166+
ContinueOnError = new InArgument<bool>((activityContext)=> ContinueOnErrorArgument.Get(activityContext)),
167+
DelayMS = new InArgument<int>((activityContext)=> DelayAfterArgument.Get(activityContext)),
168+
DelayBefore = new InArgument<int>((activityContext)=> DelayBeforeArgument.Get(activityContext)),
169+
ClickType = new InArgument<ClickType>((activityContext) => ClickTypeArgument.Get(activityContext)),
170+
MouseButton = new InArgument<MouseButton>((activityContext)=> MouseButtonArgument.Get(activityContext)),
171+
Target = new Target
172+
{
173+
Selector = new InArgument<string>((activityContext)=> SelectorArgument.Get(activityContext)),
174+
TimeoutMS = new InArgument<int>((activityContext)=> TimeoutMSArgument.Get(activityContext)),
175+
WaitForReady = new InArgument<WaitForReady>((activityContext)=> WaitForReadyArgument.Get(activityContext))
176+
},
177+
CursorMotionType = new InArgument<CursorMotionType>((activityContext)=> CursorMotionTypeArgument.Get(activityContext)),
178+
KeyModifiers = new InArgument<KeyModifiers>((activityContext)=> KeyModifiersArgument.Get(activityContext)),
179+
SendWindowMessages = new InArgument<bool>((activityContext)=> SendWindowMessagesArgument.Get(activityContext)),
180+
SimulateClick = new InArgument<bool>((activityContext)=> SimulateClickArgument.Get(activityContext))
181+
182+
183+
}
184+
}
185+
};
186+
187+
68188
try
69189
{
190+
Console.WriteLine("");
191+
Console.WriteLine("Starting Click activity");
70192
output = WorkflowInvoker.Invoke(this, input);
193+
Console.WriteLine("");
194+
Console.WriteLine("Finished Click activity.");
71195
}
72196
catch (Exception e)
73197
{

0 commit comments

Comments
 (0)