I am trying to use the “For Each File in Folder” command to print off PDFs and am unable to figure it out can anyone please help me? I tried to do a “Start process” with the executable path of “CurrentFile” and then “- Verb Print” as the argument but this doesn’t help me. One warning I get is Value ‘Fileinfo’ cannot be converted to ‘string’. I would attach the XAML but I am not able to since I am so new to the forum.
Hi @Grey_Angel
U can trust forum so U can share thr xaml if you r okey with that.
Or else
Please give some screenshot for detailed understanding for us to solve
Thanks
VP
CurrentFile is of datatype FileInfo. It’s not just the filename and path. It has multiple properties.
To get the filename and path you use CurrentFile.FullName (FullName is one of the properties of a FileInfo variable)
I was able to get the Start Process working using “CurrentFile.ToString” still trying to figure out how to get it to print without using Hotkeys because the project likes to get ahead of itself.
You really should learn how classes (and their properties) work and do it correctly. It’s a very common thing you’ll have to do when writing automations.
The .ToString method of FileInfo may give unexpected results. Per the documentation I posted for you:
ToString() Returns the original path. Use the FullName or Name properties for the full path or file/directory name.
(Inherited from FileSystemInfo)
You’d use Click activities to click around in your PDF app. Have you done the free UiPath Academy training? It covers these kind of things.
Hi @Grey_Angel
Start process will just open the file you are passing with the pdf viewer you’ve installed in your machine, i would recommend to install adobe, make it default viewer, then start process will open the pdf in the adobe acrobat application, based on that we have a shortcut Ctrl + P, with this we will print the pdf, so use a hotkey activity sending this shortcut, print the file and then close the file, do it for all the files in folder
hope it helps
Regards
If coded properly it can’t get ahead of itself. For example, say you have a Hotkey CTRL+P activity then a click activity to click something in the print window, the click activity waits until the print window appears before it executes. The automation won’t go beyond that step until the print window appears.
I decided I want to go with the Invoke powershell method to print.Below is what I have but the file name doesn’t seem to be passing all the way through.
Did this fixed ? Any updates on the code. I would like to print to some other location printer which is installed in my machine. Is that possible.