Scratch File

September 26, 2011 by Gabe | [mmd] |

I keep a scratch file in my NVAlt library. I use it to keep random bits of information that I want to out live the clipboard. It's not meant to be permanent just a stop-over to some other destination. My clipboard is pretty volatile since I have a number of macros and scripts that temporarily hold bits of information on the clipboard. If it's something I might need later, then I better get it into something a bit more permanent. A scratch file is perfect for this.

The file is titled "qqq_Scratch.txt" after Merlin's trick. I don't have many files that start with "qqq" but a scratch file needs to be available as soon as I open my notes. I also pin the file to the top of my Simplenote list. So, yeah, I use it a lot.

I was pasting a bunch of info back and forth to it the other day and suddenly realized I could quickly make a macro to do the job. It's really just a shell script:


do shell script "echo >>  '/Volumes/Macintosh HD 2/Dropbox/Notes/qqq_Scratch.txt'
pbpaste >> '/Volumes/Macintosh HD 2/Dropbox/Notes/qqq_Scratch.txt'"

The first echo command adds a newline to the end of the file. The second pbpaste command pipes the current clipboard entry to the end of the text file.

The first thing I did was make a new Keyboard Maestro macro out of this. It works perfectly. I also decided to make a LaunchBar action out of the command.

To create the LaunchBar action, I saved the above AppleScript to a folder I keep on Dropbox for LaunchBar scripts. It's particularly easy to create AppleScripts for LaunchBar if you don't need to pass parameters. I've created a custom list in the LaunchBar index where I manually add the scripts I create.

Screen Shot 20110926 171420

So to use this script from LaunchBar, I copy some text to the clipboard and then CMD-SPACE to access LaunchBar. Start typing the name of the script (Clipboard to Scratch) and hit return. Within a second, the clipboard contents (as long as it's text) is appended to the end of the scratch file.

blog comments powered by Disqus