Skip to content

General-remember

Remembers a text

param([string]$text1 = "", [string]$text2 = "", [string]$text3 = "")

try {
	if ($text1 -eq "") { $text1 = Read-Host "Enter what needs to be remembered" }

	$stopWatch = [system.diagnostics.stopwatch]::startNew()

	[string]$timestampString = Get-Date -UFormat %s
	$timestampString = $timestampString -replace ',','.'
	[int64]$unixTimestamp = $timestampString

	$path = "~/Remember.csv"

	if (-not(Test-Path "$path" -pathType leaf)) {
		Write-Output "TIMESTAMP,TEXT" > $path
	}
	Write-Output "$($unixTimestamp),$text1 $text2 $text3" >> $path
	$path = Resolve-Path $path

	[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
	"? Saved to $path in $($elapsed)s."
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

Specifies the text to memorize

An interactive directory of PowerShell scripts.