November 24

Using Jamie Rubin’s google word count tracker with Scrivener – without effort

Jamie Rubin gave us a Halloween present this year by adapting his set of Google scripts that track changes, word count, and progress to be able to handle txt files in your google drive.

Of course, my first thought was how to apply this to Scrivener. At first, I thought I could use Scrivener’s sync folder to accomplish this. That would only work well with some tweaking that would affect my other workflows, and force me to work on only one project at a time. You see, Scrivener expects that when you setup a sync folder, it’s dedicated to the project you’re working with. On top of that, it wants to put all of the text files in a Draft folder. So if you have two or three projects going, you have two or three sync folders, each with it’s own Draft folder. With NaNoWriMo on the horizon, time was of the essence, so I settled for doing text compiles of my novel as I worked on it.

That had two big problems.

  1. It meant I had to remember to compile every day. If you know anything about me, its that remembering to hit a button every day for a month (or longer) is going to have occasional failures.
  2. Although Google will let you store files of various sizes on your drive, Jamie’s scripts rely on Google’s api for  accessing them to get stats and do comparisons. Unfortunately, that means that once your file is more than 20k or so, its too big for the scripts to work with. Think that’s big? My small novel of 70k words had to split into three files in order for the scripts not to die on me.

For the remainder of NaNoWriMo, that’s what I did. I finished writing that novel yesterday, so today I decided to correct this process. I’m on a Mac, and these instructions are very Mac specific (or Linux, but certainly not Windows, at least not without some cygwin – sorry!) What I’ve finally settled on works without me needing to remember to hit a button, without any special changes to Jamie’s scripts. What I did have to do, though, is learn to treat the folder that Jamie’s scripts are watching less like a place I can write, and more like a destination for my files.

Here’s what I’ve done:

  1. In my project, setup sync to folder. I like to put this on dropbox (so I can use an editor on other machines to work with the files), but that’s optional.
  2. Make sure you are putting text files in your sync folder, and only grabbing what you want to grab – what you’ve written, not research, etc.
  3. I wrote a small script that roots through my export folder, grabs text files that are new, copies them to my Google drive – and renames them as it does so, prepending the project name. Why? Because I typically have a structure of Chapter/Scene, where Chapter is the POV, and the file that makes up a scene is literally named Scene. When Scrivener exports this, what you get are a lot of Scene’s with numbers attached to them. By prepending the project name, what ends up in my Google folder is still unique. Finally, I have a cron job that runs a minute before midnight to grab all of my files. The script is simple:


# Ignore space in file names
export IFS='


# Get a list of directories you've exported
for x in `ls $SE`; do
# Just to be safe, make sure we have a Draft directory - otherwise its just flotsam
if [ -d "${SE}/${x}/Draft" ]; then
# paranoia - making sure spaces in the path are ok
path=`echo ${SE}/${x}|sed -e "s| |\\ |g"`
# Find txt files that are less than a day old in our export dir
for file in `find ${path} -name "*.txt" -type f -mtime -1d`; do
# Just grab those files that actually have more than one 2 words - this eliminates things like the directory files
if [ `wc -w ${file}|awk '{print $1}'` -gt 2 ]; then
# Build our new file name
newf=`echo $file | sed -e "s|${SE}/${x}/Draft/||g"|sed -e "s| |_|g"`
# Rsync the file to your google path [FIX THIS] - rsync preserves timestamps
rsync -av $file $HOME/Google/Writing/${x}-${newf}

The cronjob is really simple:

59 23 * * * $HOME/where/I/put/my/scripts/scrivener2google >/dev/null 2>&1

I realize there’s a few things here are technical. If you have questions, let me know!

November 22

A late nanowrimo update

Technically, there’s still about 9 days left (as I write this). That said, I have 600 words left to write to reach 50k, and probably about 10k to be done with the actual story.

I think my other writing attempts this year helped train me for this Nanowrimo. It was certainly much easier to hit my number this year. Part of that is no doubt because this year is special – no commute. For so many years before, I was driving for at least two hours a day. After we move to San Francisco next year, I’ll probably be back in the commuting game, which means less time for Nanowrimo. This year definitely had some temporal advantages in its favor.

It’s been more than that, though. The extra time helps, but so does the repeated practice at novel writing this year. Looking back over this year’s statistics, I follow a distinct pattern. Early on, I was hit or miss on word counts, but then I would hit a stride. My numbers weren’t always high, but they were pretty consistent. This Nanowrimo, that came in handy. I had a good idea of what I was writing, and I hit my stride pretty early on.

The sad thing is I don’t even know if I like the novel anymore. I realize that could just be writer’s apathy talking, but the more I practice writing novels this year, the less enamored I am with my writing, especially in the genres I love. There’s something stilted in my writing, a stiffness that I hadn’t expected to find there.

So what’s next? Well, first I want to finish this story. Nanowrimo or not, there’s more than 50k worth of story here, and I’d like to see that completed. I also have a few ideas floating around for something, well, not science-fiction, not epic fantasy.

Obligatory graphic: