Well, to answer your second question: the best way (IMO) to get a screenshot saved to a folder is to use a shell script with the built-in command screencapture
like so:
screencapture -x -t "$FORMAT" "$FILE"
where $FORMAT
is something like jpg
and $FILE
is the name of the file you want to use.
However, as you've seen, getting a screenshot when your Mac is locked is a problem. That's why we need a different tool.
wkhtmltopdf
and wkhtmltoimage
are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely "headless" and do not require a display or display service.
Download the macOS installer. Note that you will have to right-click » Open to bypass gatekeeper, as the package isn't "signed" which poses a risk if the program contains malware. All I can tell you is that I have done so and suffered no ill fate. YMMV, Use at your own risk, etc.
Here's an example of how to use wkhtmltoimage
to make a JPG of a recent blog post that I wrote:
wkhtmltoimage \
--format jpg \
https://rhymeswithdiploma.com/2021/08/05/a-place-for-everything/ \
"$HOME/Desktop/A Place for Everything.jpg"
So, now the question is, how do we set this up to save with a new filename every day in a folder that you designate?
Something like this should work, I think:
You can put that right into Keyboard Maestro as a shell script.
You will need to customize at least one line of the file:
URL='https://www.abc.com'
As I doubt you really want ABC's homepage.
Also you may want to change this:
DIR="$HOME/Desktop/Screenshots"
to the name of whatever folder you want to use. It will be created if it does not exist.
Filenames will be something like this:
2021-08-07--00.54.03.jpg
For 12:54:03 a.m. on August 7th, 2021.
That can also be adjusted if needed. Just let me know and I can tell you how to tweak it.
Feel free to ask questions if you have them!