Monday, January 18, 2016

Adding Search and Keywords to the File-Text Wiki

While I will probably never use the Text-File Wiki as a serious alternative to ConnectedText, I do find it interesting to play with this rudimentary personal wiki. Ashby had his hobbies, I have mine: book hunting, mechanical pencils, watches, and AutohotKey. I have pursued this AhK project for the last few days, and it occurred to me that it would be nice to have categories or keywords to tag the files. This is easy to implement in one sense, as all you need to do is to add phrases like "kwphilosophy" or "kwgeneral", etc. where "kw" stands for "kewyword" and does not naturally occur in English.

However, such keywords are useless, if you do not have an easy way to find them. Quickpad has no search function at all. Choosing another text editor would not solve the search problem either, as most of their search capabilities are rather weak. I decided to use a dedicated program that searches within text files and can be restricted to the directory in which I keep the wiki. The best I found is FileSeek. It's fast (though I obviously could not test it on a large number files), it has a freeware version, and it allows for complex searches as well as RegEx.[1]

I have therefore added the following to the script.[2]
^+=::
run C:\Program Files\FileSeek\FileSeek.exe
return
I know the whole thing is cobbled together, but, for what it's worth, it does not have that feel to me :)

Later that day (18:08): For anyone who is interested, I have added the ability to do back links and to select keywords from a listbox. (These changes are not reflected in the version of the script given in [2]).




1. The cheapest professional version for (one computer) is U.S. $9.00 which seems to me more than reasonable for what you get.
2. This is what the script looks like now:
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other 
;
; Script Function: Make a simple desktop wiki
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;———————————————————————————————————————————————————-

SetTimer,UPDATEDSCRIPT,1000
UPDATEDSCRIPT:
FileGetAttrib,attribs,%A_ScriptFullPath%
IfInString,attribs,A
{
FileSetAttrib,-A,%A_ScriptFullPath%
SplashTextOn,,,Updated script, 
Sleep,500
Reload
}
return 

#Persistent
#SingleInstance force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#IfWinActive ahk_class zeniko's QuickPad 

^~LButton::

winactivate
clipboard =

send ^f]{Enter} ; Find ]
;Send {Right} ; move one space to the right
sleep 100

send +{Home}
send ^c  ;selects what is to the left of "] " and copies it
sleep 100

winactivate
send {home}

clipboard := RegExReplace(Clipboard, ".*\[", " ")
name = %clipboard%
thefilename = %clipboard%.wki

IfExist, %thefilename%
{
run %thefilename%
Sleep, 100
Send, `n{BS}
}
IfNotExist, %thefilename%
{
FileAppend, %name%`n`n, %thefilename%
run, %thefilename%
Return
}
else
Exit
Return

^+=::
run C:\Program Files\FileSeek\FileSeek.exe
return

#IfWinActive
You will notice that I am now using RegExReplace to isolate the file name (and ^~LButton:: or Ctrl Left Click to open wiki links).

2 comments:

Till Pouchar said...

… if you do not have an easy way to find them
You might have a look at »Mein digitaler Zettelkasten oder Über die Dynamik des nicht konkreten Suchens «http://nota.dialogus.de/mein-digitaler-zettelkasten-oder-ueber-die-dynamik-des-nicht-konkreten-suchens/ in German, pointing to the software »Archivarius 3000«.

MK said...

SEHR interessant. I will take a closer look at it.