Launchy: Append text to a file from anywhere

Being able to write to a text file while in a whole ‘nother application is killer app as far as GTD-fu goes. This trick/hack/feature first came to my attention via the indisposable 43Folders but sadly, only though Quicksilver which is only for MacOS.

Launchy (think of it as Quicksilver Lite for Windows) doesn’t make this possible out of the box. But with Launchy and a very small batch file you too can append text to a file from anywhere without opening the text file. Yes, with QS you can magically append or prepend text to many files. Again, QS is amazing whereas Launchy is merely excellent.

How to Magically append text to a file from Launchy

  1. download and install Launchy. It’s tiny and (opensource and) free.
  2. create a directory called ‘scratch’ in c:
  3. create a batch file called add.bat that has this and only this line
    echo %*>>C:scratchscratch.txt
    • [Geeky digression] what this is doing is telling Windows to append all the parameters passed to add.bat to the file scratch.txt. It passess all the parameters in %*, >> is the append command and the file path is where your text file is.
    • You want to pass all the parameters because parameters are space-separated. If you just passed one parameter, %1, you’d only get the first word you typed.
  4. invoke Launchy. Right-click it and access the directories menu. Add the directory c:\scratch. For c:\scratch, add the file type “.bat”. Click OK to back out of the menu.
  5. re-invoke Launchy. Type add, TAB, and a string to append to the (currently inexistent) scratch.txt file, say ‘woohoo!’ and press enter. You might notice a quick flicker of black as a terminal window flashes open and closed.
  6. open scratch.txt and see that your text was added to the file.
  7. close scratch.txt and invoke Launchy and type add, TAB, and some other text. Open scratch.txt and see the text appended after ‘woohoo!’.

It must be said that this is nowhere near as awesome as the way that QS does it. You are limited to one file and you get the annoying black flicker. On the other hand, it works.

Why you’d want to do this

I could write a bunch of reasons why you’d want this. Basically, it comes down to being able to capture thoughts about stuff related to project N when you’re working on project A without changing apps, looking away from the computer, switching apps or anything else that might get you out of the flow state that is so hard to achieve. Merlin said (of the QS method, but it applies here):

It’s jaw-droppingly useful, and is the single best way I know of to ensure that “ubiquitous capture” can always occur without causing disruption or unnecessary modal change.

[...] you’re a few fast keystrokes away from capturing your brilliant but ephemeral idea without stopping what you’re doing. This is huge, in practice, believe me.

Of course, if you’re using ThinkingRock, as I am, being able to append text to a file in this way is amazingly cool. ThinkingRock allows you to import a text file to the “collection” step. The imported text file needs to be formatted one thought per line. You can then process the thoughts into Next Actions or Projects. Capturing the thoughts is the key to getting them into the “trusted system” (in GTD parlance). Being able to extremely quickly capture a thought as it occurs without a mode shift to another program is awesome.

EDIT: Hello, Lifehackers! As if it needed to be said, this script is excessively simple and hacky. Much better scripts are available, as I described, from the Launchy forums at Sourceforge.

About these ads

22 comments on “Launchy: Append text to a file from anywhere”

  1. Kodachi (see my link) can do this much more akin to the Quicksilver way of doing it.

  2. I came across Koachi when looking for a QS-alike but dismissed it as it was in still in limited-beta.

    However, I’ve just applied to be a beta tester.

  3. Wow. This is amazing! I tried this with AutoHotKey and plain txt files a while back. I use Thinking rock, too so I’m going to give this a shot. Thanks for the tip.

  4. It works with Keybreeze too, very nice!

  5. I setup everthing as shown but when adding some text the only thing added to my text file is ” echo is on” how do i fix this. I think this would be very usefull once I get it working.
    Thanks

  6. Doug, sorry, I have no idea. Someone at Lifehacker will know.

  7. @Doug: I think your batch-file is correct but that there is something wrong with your launchy-command.
    Try it out by opening a command prompt, switch to the folder where you have saved the batch and run ‘add testing the batch’. If this is working fine, then you should check the Launchy-part…

  8. I’ve tested the batch, which works, but it still only shows ‘Echo is on’ with Launchy. What would be wrong with Launchy?

  9. @Koenie: Hey! I have this same problem … I’ve tested as you suggested to Doug. It works fine through the regular command prompt. How can I test the Launchy part? :)

  10. @Doug: Had same problem as you had, and it turned out I was using 1.0.0 version of launchy. At sourceforge I could download version 1.25. I closed launchy (pop up launchy, then Alt+F4), then I installed at the same directory as I had installed the first time. The problem was solved, and my list of directories, extensions etc was kept. Sweet.

  11. Works great now. Thanks for the help everyone.

  12. I don’t know if anyone has this problem, but a new line is not added to the end of the text. So, as a result all text is added to the same line in the file.

    I added the following line to the batch script to solve that problem.

    echo OFF>>c:\scratch.txt

  13. Really? It’s always added a new-line for me.

    But I’m glad you were able to fix it. :)

  14. [...] require Twitter (ahh….), but it does use another batch file. This method comes from the Making the Ordinary weblog, and I’ve included it in the download above. To use it, you need to have a place you want to [...]

  15. Came here thru lifehacker. Thanks for the tip.

  16. Nice hack, Ben!

    I’ve made a slight adjustment that also inserts the current date and time, along with the text to append. The instructions are here.

  17. [...] I’ve added a command to Launchy that appends file when I use command ‘do’ (http://benkraal.wordpress.com/2007/05/16/launchy-append-text-to-a-file-from-anywhere/). Normally I use QuickSilver on a Mac and this feature is available from [...]

  18. Thank you very much, this was very usefull.

    Just one thing I found rather helpfull, if you want to add the date before each new scratch.txt entry use this batch file command:

    “echo %date% – %*>>C:scratchscratch.txt”

    If you want date and time use this one:

    “echo %date% %time% – %*>>C:scratchscratch.txt”

    And you put only one of those lines, instead of the one informed above.

  19. I like this. the link above for adding a timestamp was broken. I figured out how to do that, so I’ll add it here:

    echo %date% %time% %*>>C:\scratch\scratch.txt

    Sample output:

    Fri 01/15/2010 10:50:52.67 test timestamp now

    It looks like the backslashes (after C: and between the “scratch” directory and the “scratch.txt” file) are missing in the original example. Did WordPress eat them?

  20. To avoid the black flicker, you can create a shortcut that points to your batch file, have launchy catalog your shortcut instead, and set the shortcut property to run as minimized.

  21. How to make æøå work?

  22. I’ve been using Launchy for quite a while and and always thought it’d be a nice, quick way to log phone calls. This method seems to fit the bill, especially with the automatic timestamp. If anyone is still tracking these comments, has a better way to do this with Launchy been found?


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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: