Get File Name of the xaml file which is currently running


#1

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


#2

@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)

#3

Hi. I implemented your code. But i am getting “Folder” as an output.
“d:\Folder\test.xaml”


#4

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

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

#5

@indra Please find the image


#6

@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

CurrentXaml


#7

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


#8

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


#9

@indra yes “test.xaml” is inside.

image


#10

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


#11

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


#12

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


#13

@Dominic

Thanks a lot.