FASTVBS is a compact database

I saw an very interesting post on Lifehacker regarding a command line database. I was a little intrigued by the title and decided to read on. It was technically a database (but forget all about your RDBMS). [Link -> Original idea from Rad89]

I thought it was a very interesting idea, but I usually don’t use the command line (more of a GUI person). For my automation needs I usually revert to VBScripts. I simply wrote a VBScript that in turn prompted me for my input, which in turn became the arguments for the command-line utility. This was all nice but why maintain a .vbs as well as a .bat. So here comes FASTVBS the same implementation done completely in VBScript.

‘ notes.vbs
‘ Author Shehzad Kazmi
‘ Version 1.1 – May 2009
‘ —————————————————————‘

‘Create Shell object
Dim objShell
set objShell = WScript.CreateObject(“WScript.Shell”)

Dim notesDB, instructions, inputT

‘Set the notesDB files”)
notesDB = objShell.SpecialFolders(“MyDocuments”) & “\notes.txt”

Dim filesys, filetxt
Set filesys = CreateObject(“Scripting.FileSystemObject”)

If not filesys.FileExists(notesDB) Then
filetxt = filesys.CreateTextFile(notesDB, True)
End If

instructions = “USAGE: keyword” & vbNewLine
instructions = instructions & “-add “”some string of data””” & vbNewLine & vbNewLine
instructions = instructions & “Enter your term: ”

inputT = InputBox (instructions)

If inputT “” Then

Select Case Split(inputT,” “,-1,vbTextCompare)(0)
Case “-add”
objShell.Run(“cmd /c echo ” & Replace(inputT,”-add “,””) & ” >> ” & notesDB)
Case Else
Set objSE = objShell.Exec(“find /i “”” & inputT & “”” ” & notesDB)
WScript.Echo objSE.StdOut.ReadAll
End Select
Else
WScript.Quit
End If

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s