My recommendation is to do a web search for something like âEpson test page printâ and see if you can find either the same one that it prints or something which will serve the same purpose.
Once you find it, save it as a PDF (use the âPrint to PDFâ feature in macOS if needed) and save it as a PDF to something like ~/Documents/TestPage.pdf
.
Create a new Keyboard Maestro macro and add the action âOpen a File, Folder or Applicationâ to it.
It will look like this:
Note the area I have circled in blue and the red rectangle.
Click on the icon in the blue circle and select your ~/Documents/TestPage.pdf
file. It should now look like this:
Now click where it says âDefault Applicationâ and it will show you a list of your running applications. But you want to ignore all of those and go down to âOtherâŠâ as shown here:
Keyboard Maestro will open a window to your âApplicationsâ folder, which is usually what we would want. But not in this case.
Press Command+Shift+G (ââ§G) which will bring up âGo to FolderâŠâ and enter ~/Library/Printers/
It should look like this:
Click âGoâ and now you should see some âappsâ for all of your printers. Select the one for your âEpson SC-P7500â. I donât have that exact same printer, but hereâs how it looks if I select my Brother HL 2270DW:
Now, when that macro runs, it should print that PDF that you told it to open. When you run it, you should see the app open in the dock.
If the app stays in the DockâŠ
For some reason, when we do this the printer app does not quit itself, and ends up hanging around in the dock, which is not what we want.
If that happens to you, add a âQuit a Specific Applicationâ action, and in the list of running apps, look for PrinterProxy
:
Once you select PrinterProxy
Keyboard Maestro should show you the actual name of the app that you were expecting:
Now you have a Keyboard Maestro macro which should printer your test page and quit the printer application, and it should work even if your Mac screen is locked.
VoilĂ
End of lessonâŠ
âBut TJ! What if I want a geekier solution which is going to be slightly harder to set up and involves a shell script!?!â
Well, ok, since you askedâŠ
(Note: the following is another option that you could use instead of what I described above. You do not need both.)
There is a Unix command lpr
which you could use.
If you only have one printer, or if the Epson is your default, itâs extremely easy. Just use this:
lpr "$HOME/Documents/TestPage.pdf"
in a Keyboard Maestro macro âExecute a Shell Scriptâ and BAM! you should be done.
It gets trickier if you have more than one printer because then you need to use the -P
flag and the CUPS name of the printer, which (for me) is Brother_HL_2270DW_series
so I would use this:
lpr -P "Brother_HL_2270DW_series" \
"$HOME/Documents/TestPage.pdf"
To find the CUPS name, go to System Preferences » Printers & Scanners then select your printer, and finally click the âOptions & Suppliesâ button:
Once there, look for the âDevice Nameâ shown here:
Pro Tip: If you double-click on the Device Name you can âcopyâ it to the clipboard and then paste it into your Keyboard Maestro macro.
Questions?