How to process (cycle through) ie open +print+close➜ next file for all files in a folder one by one

For reasons I fail to understand, and despite my best efforts, I must go through an all (PDF Expert) to properly print PDF files. I have been unable to change the default print setting to B&W. I suspect that it may have something to do with Brother wanting to force default color printing (although within an app, I can specify my own print settings but can’t change the default)
If I print directly from Finder, I end up printing in color. To print in B&W, I have to go through an app (Preview, PDF Expert) to print.
I would like to process (=cycle through):

  • all files
  • in a specific folder set in advance in the macro (do not need to select a different folder each time)
  • the ‘process’ would be to open file in PDF expert ➜ Cmd-P (print) ➜ Cmd-W (close file)
  • then go to the next file and do the same
  • stop macro when all files have been processed.

Thanks very much for your time and help

Hi @ronald,

PDF Expert unfortunately isn't scriptable, so if you really have to go through it to print PDFs how you want, hopefully this should get you most of the way there (make sure to first change the path in the For Each action, currently set to ~/Downloads by default, to the folder that contains the files you want to print):

Print All Files in Folder Using PDF Expert.kmmacros (8.5 KB)

1 Like

thanks very much !!

1 Like

The macro works beautifully.

Just had to replace Press button print with typing enter.

For my education, could you explain what the following does:

I just discovered a little problem and am not sure how to correct it.
I just downloaded a number of PDFs. Your macro worked perfectly.
The problem is that they were all printed in color, which is not necessary for that type of document.

The way I manage this manually, is that for the FIRST printout, for the first document printed, I do the following:

  • File ➜ Print
  • tab
  • I press P (which brings up my B&W print setting)
  • pause for 0.5 seconds

Once the printing is set to B&W it will do so for all other documents until it is reset to color (because printer settings are set to last used settings).

The File ➜ Print➜ tab➜ 'p’➜ pause is easy to create, but I am not sure where to put it in the macro so it is done only once for the first printout, and not recursively for each file.

I'm surprised that doing one print in B&W isn't enough to keep it in B&W for subsequent printings, since that's how it works on my Mac, but if you need to make sure it's set to B&W for the first print and no other prints in a single run of this macro, here's a version that will do that (new actions responsible for this are highlighted in yellow and orange):

Print All Files in Folder Using PDF Expert 1.1.kmmacros (10.3 KB)

The "Pause Until" action you asked about in your second to last post was essentially a leftover from a previous version of the macro that used "Close Window" instead of "Quit and Close All Windows," and was there to ensure the menu command I wanted to select existed before proceeding. Fortunately, it seems like such an action is no longer needed, so I removed it from this version.

1 Like

Thanks very much for your time and great macro !
The B&W problem arises if I happen to have printed in color just before the first run on batch printing in the downloads folder. After the first B&W prints, all prints are B&W , so all is fine.
Your help is greatly greatly appreciated.

1 Like