InvokeCode Example

Take a look at this, i found it takes same time to process. I am unable to figure out it clearly in the view of memory consumption.

1 Like

Hi @blaze.1411,

Thats y I said may be. Depends upon the situation. But the time study is good one when we go with the performance. And if you have an activity for example to Open browser. you can use it. Unnecessarily why you are using invoke code. It takes your time also, But really I like these conversation in the form.

Regards
Balamurugan.

1 Like

Ok ! Thank You ! @balupad14 !!

Welcome @blaze.1411

Dear all, I would like to enter a VB.Net code to change my windows password. Any experiences for doing so? I have tried:

Dim res As NET_API_STATUS = NetUserChangePassword(Environment.UserDomainName, Environment.UserName, oldPass, newPass)
If res <> NET_API_STATUS.NERR_Success Then
Throw New ApplicationException(“Error setting password - Error code:” &res.ToString())
End If

However, I am getting the following error:
Error compeling code:
Error BC30002 Type: NET_API_STATUS is not defined. At line 1 Error BC30451: NET_API_STATUS is not declared. It might be due to its protection level at line 2.

Thanks!

I need to invoke below code in uipath, can anyone help me.

Using System;
Using System.Globalization;

Public Class Program
{
Public Static void Main()
{
DateTime time = New DateTime(2020, 4, 2);
Console.WriteLine(time.GetWeekOfMonth());
}
}

Static Class DateTimeExtensions {
Static GregorianCalendar _gc = New GregorianCalendar();
Public Static int GetWeekOfMonth(this DateTime time) {
DateTime first = New DateTime(time.Year, time.Month, 1);
Return time.GetWeekOfYear() - first.GetWeekOfYear() + 1;
}

Static int GetWeekOfYear(this DateTime time) {
    Return _gc.GetWeekOfYear(time, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
}

}

Regards,
Dilini

1 Like

What issue are you running into when you try to just copy + paste into an invoke code activity?

Also, why are you using invoke code for this? This is a relatively simple piece of code and I dont think I understand what the advantage would be for using invoke code? It could be done using a few assign activities instead which would be quicker and easier for others to understand.

@Dave It’s not working just paste the code in invoke code activity, did you try it? it’s giving compiler errors. i need to resolve those with someone help.

Worst case I am going to do this with assign activities