[Solved] String Variables not Displaying in Moved File Name

uiautomation
file
variable

#1

I’m working on a project where I log into a website and download an excel file over multiple days. However, the excel file downloads using a ‘file’ extension. So, I have to find the file and rename it using a date variable to separate it from future file downloads as they all download with the same filename. Also, I have to add a “.xlxs” file extension so I can open the file and use the data contained in the work book. I’m using the move file activity to rename the file once it’s downloaded. This is where the problem lies. When I go to add text and concatenate my variables with the rest of the file path, the activities run fine and complete without errors. When I go to check the renamed file, the date is not applied to the file name, but the non-variable strings are. I have a startDate and endDate variable which I have verified are displaying a string properly using a message box. The activities complete without error, the file is renamed, and my variables are not applied. How do I go about adding variables to my file name so they are displayed correctly when I use move file to rename them?

Thanks for your time!


#2

Can you share your xaml


#3

Since I am a new user I can not upload attachments, sorry.


#4

I couldn’t upload the xaml but here are screenshots of the sequences that I’m working with. Now when I try to use this method of move file while using a variable, I get a path not found error. The variables are being assigned and invoked correctly, the message box I used to test the variable assignment and recall displays properly. Is there a different way I should be trying to rename a file using a variable?


#5

Looks like your Source is a Directory and Destination is a File?


#6

The source is actually a file with the extension file, so its a file without an extension. I was able to move and rename the file previously, and the only problem I was running into was that the variables would not display as part of the new file name. Now, when I add the assignment the I get this error:


#7

Can you send you message box value you get for the variable.


#8

The variable is displaying correctly, that’s why I’m scratching my head:


#9

You need to remove the forward slashes from the date, they will be treated as individual folders.

strDate.Replace("/","_")


#10

That fixed it perfectly, thanks so much! I can’t believe I didn’t think of the forwarded slashes!

Thanks Again!!