Get File Name of the xaml file which is currently running

Suppose I am running a file “test.xaml” file. I need to get that “test” as a output.

@kirti.iyer Following code gives your current work directory

                   assign a = System.IO.Directory.GetCurrentDirectory

         Following code gives file name

                   assign a = a.Substring(a.LastIndexOf("\") + 1)

Hi. I implemented your code. But i am getting “Folder” as an output.

@kirti.iyer It is working for me. Try another way In the second assign activity

                      assign a = a.Split("\"c).Last

@indra Please find the image

@kirti.iyer After first assign actvity use message box and see what all the values you are getting

In the code i mentioned after first assign activity it will give following result

For example F:\Uipath\Folder\CurrentXaml

After Second assign activity it will give only


@indra Hi. I am getting the directory path (D:\Folder) and current directory (Folder) but not the file name (test.xaml)

@kirti.iyer Is Xaml file is inside the folder?

@indra yes “test.xaml” is inside.


@kirti.iyer check attached file GetCurrentXaml.xaml (8.4 KB)

With your [GetCurrentXaml.xaml ],
If the number of [xaml] files is more than 2 ,
you can not catch which is just started in process.

Here we have a custom activity for it. Follow that thread and will give a try :slight_smile:


Thanks a lot.