This repo contains a PowerShell script for the creation of a templated markdown-based journal entry for yesterday which imports and compresses images from a given folder.
I use it as a morning ritual writing a privately distributed family chronicle which is turning out to be a keystone habbit.
- you need the following environmental variables
Name | Example Value |
---|---|
kronScript |
c:\kronCLI\kron.ps1 |
kronMasterImageFolder |
c:\photos |
kronFolder |
c:\journal |
- You have to hard code the pattern catching the actual images for a selected timespan:
- open https://github.com/pkutaj/kronCLI/blob/master/kron.ps1#L30-L34
- based on your files, you need to properly define 2 variables:
$timeStampPattern
and$photosPattern
- just navigate to your annual
kronMasterImageFolder\yyyy
(e.g.c:\photos\2021
) and run something like
# c:\photos\2021
$timeStampPattern = "yyyyMMdd" # put the value into script when done
$yesterdayPattern = ((Get-Date) - (New-TimeSpan -Days 1)).ToString($timeStampPattern) # IGNORE
$pattern = "IMG_$yesterdayPattern.*" # put the value into script then done
(dir) -match $pattern | Select Name # run interactive pattern-check
# OUTPUT OF MATCHES
# -----------------
# IMG_20210716_1404144kron.jpg
# IMG_20210716_1416013kron.jpg
# IMG_20210716_1700289.jpg
# IMG_20210716_1700311.jpg
- You can set up an alias in PowerShell profile to call a script from anywhere
- I set an alias as
k
in the$profile
and just hitk
to run it from anywhere
- I set an alias as
$profile
Import-Module $env:kronScript
Set-Alias k new-kron
- Connect the phone to the PC in the PTP transfer mode
- Windows Photo starts automatically (if configured as such)
- Import your photos to the
kronMasterImageFolder
- I am syncing this with Google Photos at this point
- I am also deleting photos from my phone
- Recommended: Navigate to the master folder and delete redundant photos
- Total Commander for navigation
- IrfanView for quick viewing / deletion
- Run the script
. kron.ps1
(or any alias) and write about your yesterday - The script then:
- Copies, renames, and compresses images from the
$env:kronMasterImageFolder
- The script puts them in
$env:kronFolder\assets
- It populates the newly created markdown file with the image links in markdown format
- Copies, renames, and compresses images from the
- You can write about your day with photos already populated
- To merge all posts into
.pdf
to print out as a hard-copy:- Navigate to the folder of the previous month
- Run
. kron.ps1 -merge
- I am storing and sharing my journal as a family chronicle as a private GitHub repo
- See GitHub for Storage + UI for setting that up