Trigger when a new pdf file is placed and only read the newly pasted pdf file not the remaing files

Hello All ,

I have attached my workflow , I am able to succeed partial .

My requirement is below

  1. when a new pdf file with name report_1… and report_2 and similar is placed in a folder
  2. event should be triggred only when a new file is pMain.xaml (8.1 KB)
    laced example… there are already reports till report_10, I have placed a new file report_11
  3. after it triggers- This time Read pdf text should take only the report_11 file and perform the read text action.
    Where i struck is - read pdf text or ocr text is asking for the file name which I would be getting only after the file is placed in the folder. even if it has same format how will the bot only takes newly placed file.
  4. the activity I attached runs all the files in the folders since i used for reach…
    quick solution would be much apprecaited.

Buddy @vekatesh_chowdary
while getting filename in your xaml pass the value like this and change the type from string to string
like this
filename = system.IO.Directory.GetFiles(“C:\Users\JaYaKriShNa\Desktop\PDF”).OrderByDescending(Function(d) new fileinfo(d).CreationTime).First

And so there would be no need to iterate through the filename array as it is no more a array, because it has got the latest file string with it. So you can directly pass the filename variable to read pdf activity

Hope this would help you

Cheers

1 Like

This is perfect buddy…
Are this related to don,net skills ??

Yes buddy …

some times , I observe while the file is being copied …bot triggers and says … " the file is being used and throws a error" . Here I have used delay activity to avoid this… but any other solution where I can relay without delay activity … sometimes the copying may take more time than my dealy time…

Buddy read pdf text or read pdf ocr wont ask for application to open the file, but may i know how you are trying to copy, may i know the procedure you are carrying out @vekatesh_chowdary

Cheers

nice logic buddy

2 Likes

yes. it is not asking to open the file … but it asks for the file name to open…

scenario is this …

one team places the pdf for every one hour in shared drive… say the copy the pdf in to shared drive probably five files in an hour.
nor bot should be ready to capture the whole data from newly placed pdf and paste that text into another application.

so here it is not trying to open the file …but the activity requires the name of the file for which you gave solution … but the problem here is uipath background acivity is trowing an error saying “the file is being used” as i understood that it happens while the file is being copied …

use kill process buddy once after the file is copied and before being read or pasted to another application with data…that implies like how we go in task manager and kill the process or even to be simple just like closing the file if its being used …

So try that, hope it would work and pass the processname input property to kill process with the process name and you can get the process from the task manager for your application like for example excel.exe you need to mention in string “excel” alone not .exe extension

Try and let know buddy,
Still i think i didn’t get you query exactly buddy would be better if i can see your xaml… @vekatesh_chowdary in a zipped folder with project.json as well as i am not able to see certain activties
Cheers

AgentProcessImprovement.zip (12.7 KB)

attached is the zip file…

Buddy i tried the same way with same workflow with one of my set of pdf files, i didn’t throw any background errors like file is being used, and i dont find anything being copied, only read pdf ocr with tessaract and followed by a message box is used, i think it wont create any error as such, no worries buddy you can use delay for this situation or even kill process once been copied

Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.