Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

Variable File Locations

I am trying to read and write files from variable folder locations, in the form:


C:\My Drive\Audit %Read_Year% (1)\Management Accounts_%Month_in_MM_Format%%Read_Year%\AMD\Aircraft Liability\%Month_in_MM_Format%.%Read_Year%


But Process Robot is not allowing me to have the final folder location as a variable.


%Month_in_MM_Format% is a text var (but I have tried this as a numerical variable as well)

%Read_Year% is a numerical var


I have also tried saving this onto a %NewVar%, which Process Robot allows, but then when i paste the variable onto the folder location:


C:\My Drive\Audit %Read_Year% (1)\Management Accounts_%Month_in_MM_Format%%Read_Year%\AMD\Aircraft Liability\%NewVar%


The result is below:


C:\My Drive\Audit %Read_Year% (1)\Management Accounts_%Month_in_MM_Format%%Read_Year%\AMD\Aircraft Liability%NewVar


Best Answer

Hi Alvin,


Try using  C:\My Drive\Audit %Read_Year% (1)\Management Accounts_%Month_in_MM_Format%%Read_Year%\AMD\Aircraft Liability\\%Month_in_MM_Format%.%Read_Year%


 This will work, the reason behind this is, in winautomation "%" should be mention as "\%"


If you want to access a file named by a Variable, you might write "C:\folder\%filename%". This won't work, as "\%" means it isn't a Variable. Therefore, in this special case, you would need to write, "C:\folder\\%filename%", as the double backslashes mean the Variable is a Variable. Just remember: 


·%filename% is the Variable 'filename' 


·\%filename is the text %filename 


·C:\folder\\%filename% is the path to a file named in the Variable 'filename' in the folder C:\folder\


ADMIN
Answer

Hi Alvin,


Try using  C:\My Drive\Audit %Read_Year% (1)\Management Accounts_%Month_in_MM_Format%%Read_Year%\AMD\Aircraft Liability\\%Month_in_MM_Format%.%Read_Year%


 This will work, the reason behind this is, in winautomation "%" should be mention as "\%"


If you want to access a file named by a Variable, you might write "C:\folder\%filename%". This won't work, as "\%" means it isn't a Variable. Therefore, in this special case, you would need to write, "C:\folder\\%filename%", as the double backslashes mean the Variable is a Variable. Just remember: 


·%filename% is the Variable 'filename' 


·\%filename is the text %filename 


·C:\folder\\%filename% is the path to a file named in the Variable 'filename' in the folder C:\folder\

What's the error in the below path?

c:\test\\%sample1%\\%sample2%.xlsx

How is %sample2% defined? Is it a filename or a filename without extension?

Login or Signup to post a comment