Monday, July 8, 2019

Error handling for dnote & snote

After reviewing the current progress of both dnote and nnote. I've decided to break down the scripts into separate functions, subscribing to the idea of micro processes, as opposed to larger monolithic scripts.

However, I did modify the existing scripts to catch / error handle both x64-bit and x86-bit applications; below is the source code I utilized for both dnote and nnote (specifically the Daily Note version, obviously for the Named Note version, I modified for the $NamedNotesDir & $NamedNote variables).

The next iterations of these scripts will include creating separate functions. First for determining the type of note (daily or named), then creating/modifying the specified note, and finally for opening/calling the specified note.


1
2
3
4
5
6
7
8
9
try { 
    Start-Process -FilePath ((Get-ChildItem Env:\ProgramFiles).Value + '\Notepad++\notepad++.exe') -Argument ($DailyNotesDir + $Date + ".txt")
}
catch {
    Start-Process -FilePath ((Get-ChildItem Env:\ProgramFiles`(x86`)).Value + '\Notepad++\notepad++.exe') -Argument ($DailyNotesDir + $Date + ".txt")
}
finally {
    Write-Host "Ensure Notepad++ is installed in the default location" -ForegroundColor Red -BackgroundColor Black
}

1 comment:

  1. The King Casino - CommunityKhabar
    The King Casino is the only casino 출장안마 near filmfileeurope.com the casino. All casino games communitykhabar are legal and the game variety is huge! The games are also available at any bsjeon of the

    ReplyDelete