Manual editing of writing.history to count for old history

I just found the Writing History section of Scrivener. I like this! It’s one of the reasons I was loathe to drop FocusWriter.

However, I have a lot of writing history in FocusWriter that I don’t want to drop. It’s stored in an ini file that looks something like this:

2021-07-18=1028, 4453213, 2, 250
2021-07-19=102, 247563, 2, 250

Just the first two parts (date and wordcount - the others I think are time spent in program, something I don’t recognize, and daily goal) are what I want to import.

So I took a look at writing.history. Note that I do editing in Scrivener, so the numbers are probably off:

<Day dwc="941" dcc="5224" owc="0" occ="0">2021-07-18</Day>
<Day dwc="6" dcc="49" owc="0" occ="0">2021-07-19</Day>

I ran a project backup, closed Scrivener, and and tried editing dwc (as it seemed to be daily word count):

<Day dwc="1028" dcc="5224" owc="0" occ="0">2021-07-18</Day>
<Day dwc="102" dcc="49" owc="65" occ="348">2021-07-19</Day>

It worked! But what exactly are dcc, owc, and occ? Once I figure this out, I can sort of figure out how to go about importing my old history over.

  • W = Words
  • C = Characters (some countries use this rather than words)
  • D = Draft (not ‘Daily’) — i.e, written in the main Drafts/Manuscript folder
  • O = Other (elsewhere in the Binder)

The daily total is calculated from these, I think, not stored in the text file, so presumably you’ll just have to use the FocusWriter total for DWC and zero as OWC in the conversion.

As for the Daily Target (in case you haven’t come across it yet), you set it in Project > Show Project Targets under the Session Target section, so you can’t import it directly.

Does this help?

That makes sense - I did a bit of experimenting and if I didn’t zero-out the owcs I got some weird results, presumably from cutting and pasting stuff around.

For the sake of documentation, here is the Python regex that was able to convert FocusWriter’s DailyProgress.ini to Scrivener’s writing.history. Likely uglier than it ought to be - regex isn’t my strong suit.

(\d{4}-\d{2}-\d{2})=(([0-9]+)|(-[0-9]+)), ([0-9]+), 2, ([0-9]+)

<Day dwc="\2" dcc="0" owc="0" occ="0">\1</Day>


Good stuff!

I don’t know Python Regex, but use Vim for this sort of thing, and had a go just for fun…

%s:^\(.*\)=\(\d*\),.*:<Day dwc="\2" dcc="0" owc="0" occ="0">\1</Day>:

AFAICS, you only want the date (everything between the start of the line and =) and the word count (every number from = to the first comma), discarding everything else ,.+, and as you’re not manipulating the date format, there’s no point in splitting it into segments, was my thinking… I’m not an expert though, and there may be better ways in Vim regex…