When using assign, I’m trying to to this: filePath = System.IO.Directory.GetFiles(“C:\Users\myname\Desktop\Flows”) As String()
But it says “End of Expression expected.”
What am I doing wrong?
When using assign, I’m trying to to this: filePath = System.IO.Directory.GetFiles(“C:\Users\myname\Desktop\Flows”) As String()
But it says “End of Expression expected.”
What am I doing wrong?
GetFiles returns an array of Strings. Is filePath a string array?
Also you don’t need “As String()”.
Try this:
Directory.GetFiles(“C:\Users\myname\Desktop\Flows”)
And assign it to a String (array of string) variable.
That worked! Now, I’m trying to do a foreach loop to go through the files in the folder, open each one, and copy everything in the file. Any tips on how to start that?
Hi @kimbell_slice,
What type of files you are opening and from where you are copy the data. can you explain more about the activity you want to perform.
@kimbell_slice
Use a For Each activity with your filepath array as the items to loop through.
For readability I usually recommend changing the default “item” to “file”.
Also, change the TypeArgument parameter to String.
Then whatever processing you need to do per file can be done inside the loop. “file” will be the filepath of each item.
I’m opening Visio diagrams, which I want to copy and paste into microsoft Paint.
I’ve made it that far - I’m just unsure what to do inside the body of the for each loop. I’m very new to UIpath, and I don’t know what commands to use to open the files.
It’s okay, @kimbell_slice. I also encountered roadblocks such as what you are experiencing right now. But we are always willing to help you on your rpa journey
I’m not familiar with Visio, but you can use the Start Process activity and pass in the filename with most applications to open a specific file.
For example, this opens download.jpeg in Paint.
You should be able to just direct the activity to Visio instead of Paint.
Once it’s open in Visio you can use the Take Screenshot activity to take a screenshot of the item. This will store the screenshot in an image variable. From there you can save it and open it in paint to do whatever else you need to do.