Skip to content

Instantly share code, notes, and snippets.

@fatherjack
Last active August 30, 2019 10:29
Show Gist options
  • Save fatherjack/bab273d205bd5e62f40df75e965af5b1 to your computer and use it in GitHub Desktop.
Save fatherjack/bab273d205bd5e62f40df75e965af5b1 to your computer and use it in GitHub Desktop.
Creates a really quick To Do list in a notepad file, just when you want to make some notes for things to get done today
function New-ToDo {
<#
.SYNOPSIS
Creates quick To Do list in Notepad
.DESCRIPTION
Creates quick To Do list in Notepad
.PARAMETER List
comma separated list of items to put in to do list
.EXAMPLE
New-ToDo
.EXAMPLE
New-ToDo -List "Write todo function", "Update calendar" , "Book travel", "submit expenses claim", "cook dinner"
.NOTES
General notes
#>
[cmdletbinding()]
param(
# semi-colon separated list of items to put in to do list
[parameter(ValueFromRemainingArguments = $True)]
[string[]]$List
)
# split out the items we have been sent
$items = $List -split (';')
# pad the ToDo items to 5 items with empty lines
if ($items.count -lt 5) {
$items.count..5 | ForEach-Object { $items += "" }
}
# set up header of list
$txt = @"
To do list - {0:dd MMM yyyy}`r`n
"@ -f (get-date)
# add the items to the doc
foreach ($Item in $items) {
$txt += @"
[]`t$Item`r`n
"@
}
# add the footer (Done) section
$txt += @"
`r`n** Done **`r`n
"@
# create the file and display
$file = New-TemporaryFile
$txt | set-content $file
notepad $file
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment