Saturday, January 31, 2015

jrnl for ConnectedText

As I said, I don't like the command line, but I do like simple ways of entering information into programs. Day One has a quick entry mode that allows you directly interact with application without actually opening it. You can define a hotkey that brings up a quick entry window, type your note, and save it to Day One. It's more simple than the command line.

I have written a small script that does the same for ConnectedText:
; copy to date topic

InputBox, Output, Topic Title, Enter the Journal entry:
Clipboard =  `n%A_SPACE%%A_Hour%:%A_Min%%A_Space%%Output%

if ErrorLevel <> 0
    MsgBox, You cancelled
Send, !t
SendInput, %a_yyyy%%A_MM%%A_dd%`n
Sleep, 200
    IfWinActive, Confirmation
        WinActivate, Confirmation
        Send, {Enter}
        SendInput !e
        SendInput, {PgDn}
        SendInput ^v!e
SendInput, !e
SendInput, {PgDn}
SendInput, ^v!e

It copies what I write into today's topic of the journal I keep in ConnectedText. It presupposes that the preceding line starts with a space (which starts a new line without requiring a new paragraph).{1] It also presupposes that the journal tab is active. As I found it impossible to activate the journal tab within the script itself, I had to write a separate script for that. Here it is:

^+j:: ;Open ConnectedText Journal
Run, ct://Journal/20150101
WinActivate, ConnectedText - The Personal wiki System

It actually opens the journal page of January 1, 2015 (and that is sufficient).

For those who don't use ConnectedText (for whatever reason, incomprehensible to me :)), here is the script I used as a model. It saves the journal entries to a text file:

; Show the Input Box to the user.
inputbox, text, Diary,,,300,100
; Format the time-stamp.
current=%A_DD%/%A_MM%/%A_YYYY%, %A_Hour%:%A_Min%
; Write this data to the diary.txt file.
fileappend, %current% - %text%`n, diary.txt

1. There wer some glitches in the original scrip I published. They should now be fixed (13:14 on January 31, 2015).

No comments: