Skip to main content
Question

Help usign File type Variable

  • 24 May 2024
  • 1 reply
  • 59 views

What I would like to know:
How to use the “File” type Variable “Desktop Folder or File” > “Regex” feature

 

My assumption is that if I state the folder path properly (i.e. “C:\Users\MyUser\Documents\folder”)

And then in the regex section of the properties I state:

String: “example ”

Pattern: eA-Za-z0-9]+

String: “.xlsx”

I would expect the File variable to target the only file in that folder that matches the pattern, but when I run the bot the File path string returns empty.

The regular expression that should be working with should be:

C:\\Users\\MyUser\\Documents\\folder\\example oA-Za-z0-9]+\.xlsx

and I would expect it to catch the single file called:

C:\Users\MyUser\Documents\folder\example A1.xlsx

 

Am I doing something wrong? and if so, where?

Or maybe this interaction is not within the scope of the regex functionality of the File type Variable, and if so, then what would it be it’s intended function?

 

Thanks

1 reply

Userlevel 3
Badge +7

I think you’re trying to use the File type variable for something it doesn’t support. The value of a File type variable should return a valid file path (e.g. C:\folder\folder\file.ext)

I’m not sure the regex use in this context means it finds all valid files in a folder by the File variable definition. 

I think you’d want to loop through a folder of files, then use conditional expression to find the file you’re looking for.

Could you provide more details about the process you’re trying to automate?

Reply