Paddi
May 4, 2023, 7:51am
1
Hi all,
I’m wondering if UiPath can print all the PDFs in the same folder at the same time? Though I have seen some topics in the community, I am confused about, what data type should this be? Directory.GetFiles(“filepath”, “*.pdf”), and what are the “ filename”?
Or else, do you have any other solutions?
Thank you
Hi @Paddi
When you try to access Directory.GetFiles(“filepath”, “*.pdf”), the output will be of a type array of string & you can use it like this:
fileNamesArray = Directory.GetFiles(“filepath”, “*.pdf”)
Here, fileNamesArray is of data type System.String[]
(Array of String).
You can iterate through the array elements to access each file name.
Hope this helps,
Best Regards.
Paddi
May 4, 2023, 8:06am
3
hihi @arjunshenoy Thanks for your answer, and do you know how to print every single file in this array?
Do you know how can I find my server name, share name and file name in Studio? Thank you.
In UiPath, we used ‘Invoke power shell’ activity and the command used is “print /d:<ServerName> filename”
Hey @Olivia & @Smith93
Do you just want background automation of your process - meaning using Simulate Click and minimized window of Outlook or let’s say fully background - via API maybe?
For the second option there is no Print activity for now I think mostly because it depends a lot on the document type that you want to print - from what I’ve understood while reading some articles related to this.
For reference:
c# - Which Windows Print API to call from .net program - Stack Overflow - “Er, …
Anil_G
(Anil Gorthi)
May 5, 2023, 2:10pm
4
@Paddi
You can print the values or loop through values using for each loop
In for each loop in argument give the Directory.GetFiles("Folderpath", "*.pdf")
(or you can give the array of string variable if assigned to variable)
Change type argument to string
Use a log message and give currentitem which would give you the filepath
Now yo extract what you need you can get filepath usign …Path.GetFileName(currentitem)
Remaining values we need to see how that path is and may be extract it
Hope this helps
cheers