Shortcut for taking daily notes

Posted February 29, 2024

I like to create a .txt file for each day to take notes. It’s akin to a fresh sheet of paper. The name of each daily note is yyMMdd.txt for easy sorting.

Here’s my workflow for doing these daily notes using Shortcuts and a text editor.

  1. Create a directory where you want your daily notes to live. I put mine at the root of my iCloud drive in a folder called “daily”.

  2. Open the Shortcuts app and select the plus button in the top right to create a new shortcut.

  3. In the search bar on the right, type “shell” and double-click or drag the “Run Shell Script” action over to the shortcut.

When enabled, the actions "Run AppleScript", "Run Shell Script", "Run
JavaScript for Mac Automation", "Run JavaScript on Web Page" and "Run Script
Over SSH" can be run.

You may have to enable “Allow Running Scripts” in the advanced settings of Shortcuts.


  1. Ignoring the textbox that says echo “Hello World”, set the shell to “zsh” and the pass input option to “as arguments”.

  2. For the input option select “Current Date”. This input will determine what the title of your .txt file is. By default, the current date will show up as February 29, 2024 at 9:00 AM. I want this to show up as 240229; to do this, select the Current Date input and change the “Date Format” to “Custom”. Then you can replace the “Custom Format” textbox with yyMMdd.

If you want the full year in the title you can write yyyyMMdd.

  1. Finally, replace the echo “Hello World” with the following zsh script:
currentDate=$1

filePath=“PATH_TO_FILE/${currentDate}.txt"

if [ ! -f "$filePath" ]; then
    touch "$filePath"
fi

open -a “TEXT_EDITOR” "$filePath"

You will need to adjust the PATH_TO_FILE and TEXT_EDITOR . I (ChatGPT) also edited the script to add the current date to the first line of my .txt file. Here’s the final script I use:

# The first argument passed from the shortcut will be the current date in format "yyMMdd"
currentDate=$1

# Define the file path using the currentDate variable
filePath="$HOME/Library/Mobile Documents/com~apple~CloudDocs/daily/${currentDate}.txt"

# Check if the file exists
if [ ! -f "$filePath" ]; then
    echo "$currentDate" > "$filePath"
else
    if ! grep -q "^$currentDate$" "$filePath"; then
        sed -i '' "1i\\
$currentDate
" "$filePath"
    fi
fi

open -a "CotEditor" "$filePath"