-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.xaml
More file actions
449 lines (449 loc) · 32.2 KB
/
Main.xaml
File metadata and controls
449 lines (449 loc) · 32.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<Activity mc:Ignorable="sap sap2010" x:Class="JobApplicationBot_Main" sap2010:WorkflowViewState.IdRef="ActivityBuilder_1" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:s="clr-namespace:System;assembly=System.Private.CoreLib" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System.Private.CoreLib" xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=System.Private.CoreLib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data.Common" xmlns:ui="http://schemas.uipath.com/workflow/activities" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextExpression.NamespacesForImplementation>
<sco:Collection x:TypeArguments="x:String">
<x:String>GlobalConstantsNamespace</x:String>
<x:String>GlobalVariablesNamespace</x:String>
<x:String>System</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Collections.ObjectModel</x:String>
<x:String>System.Data</x:String>
<x:String>System.Linq</x:String>
<x:String>UiPath.Core</x:String>
<x:String>UiPath.Core.Activities</x:String>
<x:String>System.Activities</x:String>
<x:String>System.Collections</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.ComponentModel</x:String>
<x:String>System.Runtime.Serialization</x:String>
<x:String>System.Xml.Serialization</x:String>
<x:String>UiPath.Excel</x:String>
<x:String>UiPath.Excel.Activities</x:String>
</sco:Collection>
</TextExpression.NamespacesForImplementation>
<TextExpression.ReferencesForImplementation>
<sco:Collection x:TypeArguments="AssemblyReference">
<AssemblyReference>System.Activities</AssemblyReference>
<AssemblyReference>System.Collections</AssemblyReference>
<AssemblyReference>System.Collections.NonGeneric</AssemblyReference>
<AssemblyReference>System.ComponentModel</AssemblyReference>
<AssemblyReference>System.ComponentModel.Primitives</AssemblyReference>
<AssemblyReference>System.ComponentModel.TypeConverter</AssemblyReference>
<AssemblyReference>System.Data</AssemblyReference>
<AssemblyReference>System.Data.Common</AssemblyReference>
<AssemblyReference>System.Linq</AssemblyReference>
<AssemblyReference>System.ObjectModel</AssemblyReference>
<AssemblyReference>System.Private.CoreLib</AssemblyReference>
<AssemblyReference>System.Runtime.Serialization</AssemblyReference>
<AssemblyReference>System.Xml</AssemblyReference>
<AssemblyReference>System.Xml.Linq</AssemblyReference>
<AssemblyReference>UiPath.Excel</AssemblyReference>
<AssemblyReference>UiPath.Excel.Activities</AssemblyReference>
<AssemblyReference>UiPath.Mail.Activities</AssemblyReference>
<AssemblyReference>UiPath.Platform</AssemblyReference>
<AssemblyReference>UiPath.Studio.Constants</AssemblyReference>
<AssemblyReference>UiPath.System.Activities</AssemblyReference>
</sco:Collection>
</TextExpression.ReferencesForImplementation>
<Sequence DisplayName="Main - Job Application Bot" sap:VirtualizedContainerService.HintSize="1542,8126" sap2010:WorkflowViewState.IdRef="Sequence_1">
<Sequence.Variables>
<Variable x:TypeArguments="scg:Dictionary(x:String, x:String)" Name="configDict" />
<Variable x:TypeArguments="sd:DataTable" Name="configTableTemp" />
<Variable x:TypeArguments="x:String" Name="smtpServer" />
<Variable x:TypeArguments="x:Int32" Name="smtpPort" />
<Variable x:TypeArguments="x:String" Name="senderEmail" />
<Variable x:TypeArguments="x:String" Name="senderPassword" />
<Variable x:TypeArguments="x:String" Name="emailSubjectTemplate" />
<Variable x:TypeArguments="x:String" Name="emailBodyTemplate" />
<Variable x:TypeArguments="x:Boolean" Name="isBodyHtml" />
<Variable x:TypeArguments="x:String" Name="defaultAttachmentPath" />
<Variable x:TypeArguments="x:Int32" Name="retryCount" />
<Variable x:TypeArguments="x:Int32" Name="delayBetweenEmailsSeconds" />
<Variable x:TypeArguments="x:Boolean" Name="isDryRun" />
<Variable x:TypeArguments="sd:DataTable" Name="companiesTable" />
<Variable x:TypeArguments="x:String" Name="companyName" />
<Variable x:TypeArguments="x:String" Name="recipientEmail" />
<Variable x:TypeArguments="x:String" Name="specificAttachment" />
<Variable x:TypeArguments="x:String" Name="finalAttachmentPath" />
<Variable x:TypeArguments="x:String" Name="finalSubject" />
<Variable x:TypeArguments="x:String" Name="finalBody" />
<Variable x:TypeArguments="scg:List(x:String)" Name="attachmentList" />
<Variable x:TypeArguments="x:Boolean" Name="emailSuccess" />
<Variable x:TypeArguments="x:String" Name="emailError" />
<Variable x:TypeArguments="x:Int32" Name="retryAttemptUsed" />
<Variable x:TypeArguments="x:Int32" Default="0" Name="successCount" />
<Variable x:TypeArguments="x:Int32" Default="0" Name="failureCount" />
<Variable x:TypeArguments="x:String" Default="["data\Log.xlsx"]" Name="logFilePath" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<ui:LogMessage DisplayName="[Log] Starting Job Application Bot" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="LogMessage_1" Level="Info" Message="["=== Job Application Bot Started at " & System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") & " ==="]" />
<Assign DisplayName="Initialize Config Dictionary" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_1">
<Assign.To>
<OutArgument x:TypeArguments="scg:Dictionary(x:String, x:String)">[configDict]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="scg:Dictionary(x:String, x:String)">[New Dictionary(Of String, String)()]</InArgument>
</Assign.Value>
</Assign>
<ui:ReadRange AddHeaders="True" DataTable="[configTableTemp]" DisplayName="Read Config.xlsx" sap:VirtualizedContainerService.HintSize="524,227" sap2010:WorkflowViewState.IdRef="ReadRange_1" SheetName="Sheet1" WorkbookPath="data\Config.xlsx">
<ui:ReadRange.Range>
<InArgument x:TypeArguments="x:String">
<Literal x:TypeArguments="x:String" Value="" />
</InArgument>
</ui:ReadRange.Range>
</ui:ReadRange>
<ui:ForEach x:TypeArguments="sd:DataRow" CurrentIndex="{x:Null}" DisplayName="Populate Config Dictionary" sap:VirtualizedContainerService.HintSize="524,344" sap2010:WorkflowViewState.IdRef="ForEach`1_1" Values="[configTableTemp.AsEnumerable()]">
<ui:ForEach.Body>
<ActivityAction x:TypeArguments="sd:DataRow">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="sd:DataRow" Name="row" />
</ActivityAction.Argument>
<Assign sap:VirtualizedContainerService.HintSize="334,143" sap2010:WorkflowViewState.IdRef="Assign_9">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[configDict(row(0).ToString().Trim())]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[row(1).ToString().Trim()]</InArgument>
</Assign.Value>
</Assign>
</ActivityAction>
</ui:ForEach.Body>
</ui:ForEach>
<Assign DisplayName="Set SMTP Server" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_2">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[smtpServer]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[If(configDict.ContainsKey("SmtpServer"), configDict("SmtpServer"), "smtp.gmail.com")]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set SMTP Port" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_3">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[smtpPort]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[If(configDict.ContainsKey("Port"), Integer.Parse(configDict("Port")), 587)]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set Sender Email" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_4">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[senderEmail]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[If(configDict.ContainsKey("SenderEmail"), configDict("SenderEmail"), "")]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set Sender Password" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_5">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[senderPassword]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[If(configDict.ContainsKey("SenderPassword"), configDict("SenderPassword"), "")]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set Subject Template" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_6">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[emailSubjectTemplate]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[If(configDict.ContainsKey("EmailSubject"), configDict("EmailSubject"), "")]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set Body Template" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_7">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[emailBodyTemplate]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[If(configDict.ContainsKey("EmailBody"), configDict("EmailBody"), "")]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set IsBodyHtml" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_8">
<Assign.To>
<OutArgument x:TypeArguments="x:Boolean">[isBodyHtml]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Boolean">[If(configDict.ContainsKey("IsBodyHtml"), Boolean.Parse(configDict("IsBodyHtml")), False)]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set Default Attachment Path" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_10">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[defaultAttachmentPath]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[If(configDict.ContainsKey("DefaultAttachmentPath"), configDict("DefaultAttachmentPath"), "attachments\CV.pdf")]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set Retry Count" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_11">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[retryCount]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[If(configDict.ContainsKey("RetryCount"), Integer.Parse(configDict("RetryCount")), 2)]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set Delay Between Emails" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_12">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[delayBetweenEmailsSeconds]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[If(configDict.ContainsKey("DelayBetweenEmailsSeconds"), Integer.Parse(configDict("DelayBetweenEmailsSeconds")), 3)]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set DryRun Flag" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="Assign_13">
<Assign.To>
<OutArgument x:TypeArguments="x:Boolean">[isDryRun]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Boolean">[If(configDict.ContainsKey("DryRun"), Boolean.Parse(configDict("DryRun")), False)]</InArgument>
</Assign.Value>
</Assign>
<If Condition="[String.IsNullOrWhiteSpace(senderEmail)]" DisplayName="[Check] Is Sender Email Empty?" sap2010:WorkflowViewState.IdRef="If_SenderCheck">
<If.Then>
<ui:LogMessage DisplayName="[Log] Sender Email Warning" Level="Warn" Message="["SenderEmail is empty! Check your Config.xlsx. Mails will fail to send."]" />
</If.Then>
</If>
<If Condition="[isDryRun]" DisplayName="[Check] Dry Run Mode?" sap:VirtualizedContainerService.HintSize="524,394" sap2010:WorkflowViewState.IdRef="If_1">
<If.Then>
<ui:LogMessage DisplayName="[Log] DRY RUN MODE ACTIVE" sap:VirtualizedContainerService.HintSize="450,143" sap2010:WorkflowViewState.IdRef="LogMessage_2" Level="Warn" Message="["⚠️ DRY RUN MODE IS ACTIVE – No emails will be sent."]" />
</If.Then>
<If.Else>
<Sequence DisplayName="Else" sap:VirtualizedContainerService.HintSize="450,90" sap2010:WorkflowViewState.IdRef="Sequence_6">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</Sequence>
</If.Else>
</If>
<ui:ReadRange AddHeaders="True" DataTable="[companiesTable]" DisplayName="Read Companies.xlsx" sap:VirtualizedContainerService.HintSize="524,227" sap2010:WorkflowViewState.IdRef="ReadRange_2" SheetName="Sheet1" WorkbookPath="data\Companies.xlsx">
<ui:ReadRange.Range>
<InArgument x:TypeArguments="x:String">
<Literal x:TypeArguments="x:String" Value="" />
</InArgument>
</ui:ReadRange.Range>
</ui:ReadRange>
<ui:LogMessage DisplayName="[Log] Companies Loaded" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="LogMessage_3" Level="Info" Message="["Loaded " & companiesTable.Rows.Count.ToString() & " companies from Companies.xlsx"]" />
<ui:ForEach x:TypeArguments="sd:DataRow" CurrentIndex="{x:Null}" DisplayName="For Each Company Row" sap:VirtualizedContainerService.HintSize="524,4172" sap2010:WorkflowViewState.IdRef="ForEach`1_2" Values="[companiesTable.AsEnumerable()]">
<ui:ForEach.Body>
<ActivityAction x:TypeArguments="sd:DataRow">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="sd:DataRow" Name="companyRow" />
</ActivityAction.Argument>
<Sequence DisplayName="Process Company" sap:VirtualizedContainerService.HintSize="522,4041" sap2010:WorkflowViewState.IdRef="Sequence_5">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<TryCatch DisplayName="[TryCatch] Process Each Company" sap:VirtualizedContainerService.HintSize="488,3981" sap2010:WorkflowViewState.IdRef="TryCatch_1">
<TryCatch.Try>
<Sequence DisplayName="Extract & Send" sap:VirtualizedContainerService.HintSize="486,3325" sap2010:WorkflowViewState.IdRef="Sequence_3">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign DisplayName="Get CompanyName" sap:VirtualizedContainerService.HintSize="452,175" sap2010:WorkflowViewState.IdRef="Assign_14">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[companyName]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[companyRow("CompanyName").ToString().Trim()]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Get RecipientEmail" sap:VirtualizedContainerService.HintSize="452,175" sap2010:WorkflowViewState.IdRef="Assign_15">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[recipientEmail]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[companyRow("RecipientEmail").ToString().Trim()]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Get SpecificAttachment" sap:VirtualizedContainerService.HintSize="452,175" sap2010:WorkflowViewState.IdRef="Assign_16">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[specificAttachment]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[If(companiesTable.Columns.Contains("SpecificAttachmentPath") AndAlso Not String.IsNullOrWhiteSpace(companyRow("SpecificAttachmentPath").ToString()), companyRow("SpecificAttachmentPath").ToString().Trim(), "")]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Resolve Attachment Path" sap:VirtualizedContainerService.HintSize="452,175" sap2010:WorkflowViewState.IdRef="Assign_17">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[finalAttachmentPath]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[If(Not String.IsNullOrEmpty(specificAttachment), specificAttachment, defaultAttachmentPath)]</InArgument>
</Assign.Value>
</Assign>
<ui:InvokeWorkflowFile ArgumentsVariable="{x:Null}" DisplayName="Replace Placeholders – Subject" sap:VirtualizedContainerService.HintSize="452,177" sap2010:WorkflowViewState.IdRef="InvokeWorkflowFile_1" UnSafe="False" WorkflowFileName="workflows\ReplacePlaceholders.xaml">
<ui:InvokeWorkflowFile.Arguments>
<InArgument x:TypeArguments="x:String" x:Key="OriginalText">[emailSubjectTemplate]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="CompanyName">[companyName]</InArgument>
<OutArgument x:TypeArguments="x:String" x:Key="TransformedText">[finalSubject]</OutArgument>
</ui:InvokeWorkflowFile.Arguments>
</ui:InvokeWorkflowFile>
<ui:InvokeWorkflowFile ArgumentsVariable="{x:Null}" DisplayName="Replace Placeholders – Body" sap:VirtualizedContainerService.HintSize="452,177" sap2010:WorkflowViewState.IdRef="InvokeWorkflowFile_2" UnSafe="False" WorkflowFileName="workflows\ReplacePlaceholders.xaml">
<ui:InvokeWorkflowFile.Arguments>
<InArgument x:TypeArguments="x:String" x:Key="OriginalText">[emailBodyTemplate]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="CompanyName">[companyName]</InArgument>
<OutArgument x:TypeArguments="x:String" x:Key="TransformedText">[finalBody]</OutArgument>
</ui:InvokeWorkflowFile.Arguments>
</ui:InvokeWorkflowFile>
<Assign DisplayName="Build Attachment List" sap:VirtualizedContainerService.HintSize="452,175" sap2010:WorkflowViewState.IdRef="Assign_18">
<Assign.To>
<OutArgument x:TypeArguments="scg:List(x:String)">[attachmentList]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="scg:List(x:String)">[New List(Of String) From { finalAttachmentPath }]</InArgument>
</Assign.Value>
</Assign>
<If Condition="[isDryRun]" DisplayName="[Check] Is DryRun?" sap:VirtualizedContainerService.HintSize="452,1057" sap2010:WorkflowViewState.IdRef="If_2">
<If.Then>
<Sequence DisplayName="Dry Run – Log Only" sap:VirtualizedContainerService.HintSize="450,751" sap2010:WorkflowViewState.IdRef="Sequence_2">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<ui:LogMessage DisplayName="[DryRun] Would Send Email" sap:VirtualizedContainerService.HintSize="416,175" sap2010:WorkflowViewState.IdRef="LogMessage_4" Level="Info" Message="["[DRY RUN] Would send to " & recipientEmail & " | Company: " & companyName & " | Subject: " & finalSubject]" />
<Assign DisplayName="Set Success" sap:VirtualizedContainerService.HintSize="416,175" sap2010:WorkflowViewState.IdRef="Assign_19">
<Assign.To>
<OutArgument x:TypeArguments="x:Boolean">[emailSuccess]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Boolean">[True]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Clear Error" sap:VirtualizedContainerService.HintSize="416,175" sap2010:WorkflowViewState.IdRef="Assign_20">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[emailError]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">["DryRun - Not Sent"]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Set Retry" sap:VirtualizedContainerService.HintSize="416,166" sap2010:WorkflowViewState.IdRef="Assign_21">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[retryAttemptUsed]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[0]</InArgument>
</Assign.Value>
</Assign>
</Sequence>
</If.Then>
<If.Else>
<ui:InvokeWorkflowFile ArgumentsVariable="{x:Null}" DisplayName="Invoke SendEmail.xaml" sap:VirtualizedContainerService.HintSize="450,145" sap2010:WorkflowViewState.IdRef="InvokeWorkflowFile_3" UnSafe="False" WorkflowFileName="workflows\SendEmail.xaml">
<ui:InvokeWorkflowFile.Arguments>
<InArgument x:TypeArguments="x:String" x:Key="SmtpServer">[smtpServer]</InArgument>
<InArgument x:TypeArguments="x:Int32" x:Key="Port">[smtpPort]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="SenderEmail">[senderEmail]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="SenderPassword">[senderPassword]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="RecipientEmail">[recipientEmail]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="Subject">[finalSubject]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="Body">[finalBody]</InArgument>
<InArgument x:TypeArguments="x:Boolean" x:Key="IsBodyHtml">[isBodyHtml]</InArgument>
<InArgument x:TypeArguments="scg:List(x:String)" x:Key="AttachmentPaths">[attachmentList]</InArgument>
<InArgument x:TypeArguments="x:Int32" x:Key="RetryCount">[retryCount]</InArgument>
<OutArgument x:TypeArguments="x:Boolean" x:Key="Success">[emailSuccess]</OutArgument>
<OutArgument x:TypeArguments="x:String" x:Key="FinalErrorMessage">[emailError]</OutArgument>
<OutArgument x:TypeArguments="x:Int32" x:Key="RetryAttemptUsed">[retryAttemptUsed]</OutArgument>
</ui:InvokeWorkflowFile.Arguments>
</ui:InvokeWorkflowFile>
</If.Else>
</If>
<ui:InvokeWorkflowFile ArgumentsVariable="{x:Null}" DisplayName="Invoke LogResult.xaml" sap:VirtualizedContainerService.HintSize="452,177" sap2010:WorkflowViewState.IdRef="InvokeWorkflowFile_4" UnSafe="False" WorkflowFileName="workflows\LogResult.xaml">
<ui:InvokeWorkflowFile.Arguments>
<InArgument x:TypeArguments="x:String" x:Key="CompanyName">[companyName]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="RecipientEmail">[recipientEmail]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="Status">[If(emailSuccess, If(isDryRun, "DryRun", "Success"), "Failed")]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="ErrorMessage">[If(String.IsNullOrEmpty(emailError), "", emailError)]</InArgument>
<InArgument x:TypeArguments="x:Int32" x:Key="RetryAttempt">[retryAttemptUsed]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="LogFilePath">[logFilePath]</InArgument>
</ui:InvokeWorkflowFile.Arguments>
</ui:InvokeWorkflowFile>
<If Condition="[emailSuccess]" DisplayName="[Check] Update Success/Fail Counter" sap:VirtualizedContainerService.HintSize="452,469" sap2010:WorkflowViewState.IdRef="If_3">
<If.Then>
<Assign DisplayName="Increment SuccessCount" sap:VirtualizedContainerService.HintSize="334,143" sap2010:WorkflowViewState.IdRef="Assign_22">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[successCount]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[successCount + 1]</InArgument>
</Assign.Value>
</Assign>
</If.Then>
<If.Else>
<Assign DisplayName="Increment FailureCount" sap:VirtualizedContainerService.HintSize="334,143" sap2010:WorkflowViewState.IdRef="Assign_23">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[failureCount]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[failureCount + 1]</InArgument>
</Assign.Value>
</Assign>
</If.Else>
</If>
<If Condition="[Not isDryRun]" DisplayName="[Check] Apply Delay?" sap:VirtualizedContainerService.HintSize="452,333" sap2010:WorkflowViewState.IdRef="If_4">
<If.Then>
<Delay DisplayName="Delay Between Emails" Duration="[TimeSpan.FromSeconds(delayBetweenEmailsSeconds)]" sap:VirtualizedContainerService.HintSize="450,91" sap2010:WorkflowViewState.IdRef="Delay_1" />
</If.Then>
<If.Else>
<Sequence DisplayName="Else" sap:VirtualizedContainerService.HintSize="450,90" sap2010:WorkflowViewState.IdRef="Sequence_7">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</Sequence>
</If.Else>
</If>
</Sequence>
</TryCatch.Try>
<TryCatch.Catches>
<Catch x:TypeArguments="s:Exception" sap2010:WorkflowViewState.IdRef="Catch`1_1">
<ActivityAction x:TypeArguments="s:Exception">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="s:Exception" Name="rowException" />
</ActivityAction.Argument>
<Sequence DisplayName="Handle Row-Level Exception" sap:VirtualizedContainerService.HintSize="486,401" sap2010:WorkflowViewState.IdRef="Sequence_4">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<ui:LogMessage DisplayName="[Log] Unhandled Row Exception" sap:VirtualizedContainerService.HintSize="452,175" sap2010:WorkflowViewState.IdRef="LogMessage_5" Level="Error" Message="["Unhandled error for row: " & rowException.Message]" />
<Assign DisplayName="Increment FailureCount (exception)" sap:VirtualizedContainerService.HintSize="452,166" sap2010:WorkflowViewState.IdRef="Assign_24">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[failureCount]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[failureCount + 1]</InArgument>
</Assign.Value>
</Assign>
</Sequence>
</ActivityAction>
</Catch>
</TryCatch.Catches>
<TryCatch.Finally>
<Sequence DisplayName="Finally" sap:VirtualizedContainerService.HintSize="486,90" sap2010:WorkflowViewState.IdRef="Sequence_8">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</Sequence>
</TryCatch.Finally>
</TryCatch>
</Sequence>
</ActivityAction>
</ui:ForEach.Body>
</ui:ForEach>
<ui:LogMessage DisplayName="[Log] Final Summary" sap:VirtualizedContainerService.HintSize="524,175" sap2010:WorkflowViewState.IdRef="LogMessage_6" Level="Info" Message="["=== COMPLETED | Successes: " & successCount.ToString() & " | Failures: " & failureCount.ToString() & " ==="]" />
<ui:MessageBox ChosenButton="{x:Null}" AutoCloseAfter="00:00:00" Caption="["Job Application Bot – Done"]" DisplayName="Final Summary Message Box" sap:VirtualizedContainerService.HintSize="524,114" sap2010:WorkflowViewState.IdRef="MessageBox_1" Text="["✅ Emails processed!" & Environment.NewLine & Environment.NewLine & "✔ Successful: " & successCount.ToString() & Environment.NewLine & "✖ Failed: " & failureCount.ToString() & Environment.NewLine & Environment.NewLine & If(isDryRun, "⚠️ DRY RUN MODE – No emails were actually sent.", "Check data\Log.xlsx for details.")]" />
</Sequence>
</Activity>