Hi wonderful Powershell people
I have a script that iterates through a number of pdf files and prints. What I need is for the prints to spool as quickly as possible, appearing on the print queue in the right order however.
If I just loop through with
Start-Process -FilePath $printfilepath -Verb Print
then the jobs are sent to be printed faster than the print spooler can take them, and they appear in a random order.
However if I use Start-Process -FilePath $printfilepath -Verb Print -Wait
then on a pc with Adobe Professional it works ok and waits, but with Adobe Reader it doesn't continue until the Adobe window that has opened is actually closed.
How can I code this so that it waits until the job has actually finished spooling before moving on to the next one, and either force the Adobe window closed or ignore the fact that it is closed
foreach ($file in $sortedfiles)
{
$job_counter++
Start-Process -FilePath $file -Verb Print -Wait
}