Saturday, April 26, 2008

SubEthaEdit as a Journal

I really like SubEthaEdit, a text editor for Mac. It's mostly geared towards programming, but I find that it's a really good editor for anything text-only. For example, my journal is plaintext to avoid file format changes.

I created a script for use within SubEthaEdit's AppleScript menu. It's silly stupid, and doesn't scratch the surface of what SEE's scripts can do but it fits my needs (laziness). Basically, I wanted the same template for all my entries so if I ever want to process them, I have labeled metadata to work with. I also wanted to automatically save them into my Journal directory with a timestamp for sorting.

I know there are other journals, heck I could even use Blogger. But I don't trust online security and other Journal apps either lock you into a file format or are bloated (or both). 

So here's my script. I hope it's useful to someone.
on seescriptsettings()
return {keyboardShortcut:"^~@n", displayName:"TKJournal", inContextMenu:"no"}
end seescriptsettings

-- You should type and select the title before invoking this script
tell application "SubEthaEdit"
set mySelection to contents of selection of front document as text
set myHeader to "title: " & mySelection & return
set myHeader to myHeader & "Date: " & (current date) & return
set myHeader to myHeader & "Category: " & "Personal" & return
set myHeader to myHeader & "Tags: " & "journal" & return & return

set contents of selection of front document to myHeader

set myFilePath to POSIX path of (path to home folder)
set myFilePath to myFilePath & "Documents/TKJournal/"
set {year:y, month:m, day:d} to (current date)
set myDateString to y * 1 & "-" & m * 1 & "-" & d * 1
set myFilePath to myFilePath & myDateString & "-" & mySelection & ".txt"
save front document in POSIX file myFilePath
end try
end tell

Friday, April 04, 2008


I have been in California for 2 years and this is the second time I've had Chinese food in that time. Don't get me wrong, I've had Japanese, Thai, Vietnamese, Korean, Mongolian, Philippino, and other Asian cuisine's which would all be lumped together under one roof and called "Chinese" in Colorado. Chef Chu's in Palo Alto was delicious, but like the other place I went to, they didn't even have what I would call Chinese food staples such as Sesame Chicken, Sweet and Sour Pork, etc. The menu was slanted towards seafood, even the hot & sour soup had shrimp in it. I'm sure there's something to be said for authenticity, but sometimes you crave what you're used to.

On the other hand, I am much more sensitive to regional food now. When someone asks if I want to eat Indian, I usually ask whether the restaurant is North or South Indian (I prefer the vegetarian South Indian food). If someone wants to go to a Brittish Pub, I look forward to curry because it's going to be the best thing on the menu (besides the beer).