Extract Dynamic File name from selector

I have an issue where I have to download a report from D365 > Then open the Zip file > then open an excel doc and manipulate it some before uploading to an SFTP server. The issue I am having is getting the file name/ Path for an excel application scope. The file path and endpoint file name are the same every time, but the folder changes on every download. E.G C:\Users\X\Downloads{380BFB3E-3398-4D83-80F0-6E6443A0B54E} and C:\Users\X\Downloads {8CD9E446-D899-4F44-9341-0ABA32E3DF2C}. How can i Pull the file name from the selector on download?

Another image for more context. The Excel doc is inside of the .zip.

Hi,

First, can you check if name property has full path of the zip file at the following area of UiExplorer?

If there is, we might be able to get it from UiElement instance.
So, next, get UiElement instance (let’s say uie) using FindElement activity. Then the following expression will return content of name attribute.

uie.Selector.GetTags().Last().GetAttributeValue("name")

Regards,

The full.zip name is under the attribute. I attempted the vb command you gave in a find element activity, but the command you listed above is getting an error stating that “uie” is not declared. The browser i am using is google chrome in an incognito tab if that helps any. Apologies for the newbie/ IDK what im doing questions.

@Yoichi Please ignore. I was able to use the get attribute activity and assign it to a variable. Thank you for your input!

1 Like

Hello,

Use a find element activity and indicate the particular field. In the property “FoundElement” assign a variable. Then use the above to assign filename to a variable.

Thanks!

Hello @Ott_Branden_M , As per my understanding you are trying to download some file, but the file is coming as a .zip file and you need to extract the folder and need to get the file name?

My suggestion:

  1. Clear the download folder before script execution.(use Delete activity)
    2)Use a for each file in a folder activity and inside that use a Extract/Unzip activity to extract the Zip file.
    3)Get the folder path arrMyArray = Directory.GetDirectories(“Some Directory”) and inside that use a for each file in a folder to read the excel.

The Excel file details can be easily retrieved is you can execute a powershell code.