I’m trying to open a PDF file inside a certain directory.
Right now, I’m experimenting with the “For each” activity via
Foreach [file] in [Directory.GetFiles(filePath, “new_*.pdf”)]
As you can see, I’m trying to get all the files that has the “new” word at the beginning of the file name. At the body, I put a Start Process activity and would like to open the “file” first iteration. I tried “file.First” but it’s returning an error:
> Main has thrown an exception
**> **
> Source: Start process
**> **
> Message: The system cannot find the file specified
**> **
> Exception Type: Win32Exception
**> **
> System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
> at UiPath.Core.Activities.TaskAsyncCodeActivity`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
> at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
> at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
I also tried just putting simply “file” in the FileName field of the “Start Process” activity - it does open the files, but it opens all of the ones with “new” in their file names.
I’m seeking to know how I can open the first file > scrape/gather data > close file > open next file > and so on. Sorta kinda loop way of doing things.
Please do correct me if I asked in a wrong manner. I am somewhat new to the community. Thanks in advance!