Fixing a bad habit with GoogleCL

The Problem

I have a bad habit to confess. When I'm on the telephone and I need to write something down, I don't reach for paper and pencil. Instead, I open Notepad. I take my notes and save the file on my desktop where I can easily find it later. Information preserved! But that file is just sitting on my hard drive on my home PC. For a modern, cloud-connected individual such as myself, this is bad. I can't read that note from my Android phone, from my laptop, or even from the PC in the other room. Because it's on that hard drive.

This isn't long-term storage. I usually don't need the notes for long and I trash them within a few hours or days. If they have information of greater value, I'll copy the text into Google Docs where I can get it later. But what if I need that file before it gets deleted and I'm not sitting at my computer?

The Solution

Sure, I could open up Chrome, navigate to Google Docs, and create a new document to take my notes. But that takes a lot longer than win+r > notepad. Enter GoogleCL:

google docs edit --format "txt" --editor "notepad" --title "notes"

On Friday I wrote about setting up GoogleCL on Windows. After that setup, I can use the above command to edit a text file named "notes" that resides in Google Docs. The file is automatically downloaded and displayed in Notepad or any other editor. After saving my changes and closing Notepad, the file is uploaded to Google Docs again. Pretty slick.

Now I just need to turn that command into something more manageable.

@ECHO OFF
SET filename=%*

IF "%filename%" EQU "" (
ECHO File name:
SET /p filename=
)

google docs edit --format "txt" --editor "notepad" --title "%filename%"

I called it "gd.cmd" -- "gd" for "Google Docs" should be quick to type and easy to remember. That script will take an argument for the file name and even prompt me if I don't give a file name initially. You can change the --editor option and even the --format if you don't like plain text.

There's also a --folder option which I expected would let me keep my notes in a folder in Google Docs. Well, it does look in that folder but if it doesn't find the file, it will create the file outside of the folder, so that next time it still won't find it! I opened issue #133 to see about fixing that.

No comments:

Post a Comment