Scrivener to Word to (editor) to Word to Scrivener

Dear All,

I hope I can be forgiven for raising again a certain long-in-the-tooth wish for Scrivener: a way to round trip marked up Word output back into its sources in Scrivener. Rather than hold forth about this (as it has been discussed a good deal, in any case), what I thought I could do is simply list a set of functionalities which together seem to me to make such an idea possible:

A) Embedding hidden text into composited output* for Word. Word has a facility for hidden text. If Scrivener could write files which used this facility, sections of text could be invisibly marked to indicate what Scriv rtf file they came from.

B) Setting Word files for track-changes and locking it ON. If one locks track changes ON , then neither author nor editor could accidentally remove any special hidden markers in a Word file. Hence, no matter what happened, every section of text would remain identified as to its source in Scriv. I suppose that a word doc can be programmatically created with track-changes locked on.

C) Programmatically snapshotting a document before overwriting it. In the imagined case of a composited and then marked-up Word document coming back from an editor, hidden identifiers give guidance on how to associate segments of the Word doc with original Scriv documents, and the idea is to take the changed segments of text back to their original documents. Clearly we need to snapshot those documents before overwriting them (and also so one still has access to the compare-changes function). Geez, what a moment. Maybe this is where Scrivener cautiously decides to do a backup of your whole project before proceeding!

If one seriously contemplates what could go awry with a round-trip function like this, it is truly daunting. I know that. But it seems to me that the above capacities together suggest an interesting and perhaps not entirely outlandish possibility – one perhaps no more fragile than use of Sync to External folder, but which has greater utility for use with an editor. And the more of the above constituent abilities Scrivener has, the closer it would be to maybe being able to do something along this line.

This is a truly scary function. If you imagine importing in this special way a Word doc representing your entire novel, that function would be in the business of overwriting every document in your Draft folder. I consider it entirely possible that this is a function that writers may well dream of but should never get their hands on!

gr

  • I say “composited output” rather than compiled, since compile is too powerful to let it have its way with a doc being output for this purpose. One needs more control of the formation of the output and without complex interference, similar to the dedicated outputting for Sync to External.

I talked about this and showed how I do it in this thread:

https://forum.literatureandlatte.com/t/video-my-system-for-moving-edited-manuscript-from-docx-back-to-scrivener/45006/1

  1. I don’t think it needs to be that scary, since computers are good at carefully checking for problems. They can warn you if anything problematic has happened to the file.

  2. A backup can be done just before the return trip.

  3. A comparison can be done afterward to see if anything bad has happened.

Have you tried using the “Insert links back to Scrivener in each section” Compile option? The idea behind this is to allow round-tripping with an editor more easy, although not quite in the way you are after. What happens with this is that it places a link to the relevant Scrivener file above each section of text in the compiled document. When the document is re-imported, those links become Scrivener links. This means that you can import the document edited by your collaborator and editor and view it in one editor, and click on the links in it to open the original files in Scrivener in the other, editing them accordingly. Although this requires a little more manual work than having the files replaced automatically, it is much, much safer - many things can go awry that could really mess up your project if the overwrite was done automatically (even if you had snapshots done, you’d potentially have to go through a lot of work).

All the best,
Keith

Another resource I had not attended to!

This is good. And I find I can combine this with some of the ideas from the above. In Word, one can effectively search for all instances of the unique identifiers and have them both highlighted and made hidden.* Then if I lock track changes on, these marks are kept safe and also don’t show to the editor/collaborator. On the return the hidden marks with their highlighting are duly imported into Scrivener. So, this looks good to me.

I can see now already that I also need to give more thought to the compile format I use – with an eye toward copying the edited text back in without retro-formatting fuss.

Thanks, Keith.
gr

  • In the Find and Replace dialog box, enable Use Wildcards. For Find What enter <*>? and in Replace With enter ^& and set the format to Highlight and Font:Hidden. Of course, if you have statements of inequality or you use angle brackets in your text for other things, this won’t work.

This is great, GR! Hiding these is a perfect solution for working with editors who will complain bitterly about any change to their required submission format. I’m about to enter a round of editing for a story that’s to be included in an anthology, and I will give this a try. I’d have never found this on my own, as I’ve avoided Word as much as possible for 15 years… :slight_smile:

Thanks!

Nice. Would love to know how it goes!

It seems on the return from the editor you will have to show invisibles and be careful when accepting changes, because that could still wipe out those codes if some tracked change spans a code-marker area.

Nothing’s perfect. I’ll settle for an incremental improvement… :wink:

The process could be usefully assisted by two Word macros – one to run after compile before sending to the editor and one to run when the doc comes back from the editor. These macros automate the process of hiding the Scrivener ID codes before sending the doc to an editor/collaborator, and then protecting those codes from any tracked changes when the document comes back from the editor/collaborator.

I have included the code for these two macros here in case anyone might find them useful.

1) Scrivener_ID_Hider()

Suppose you compile to docx with the these enabled: option Insert Links Back to Scrivener and suboption Insert Unique Identifiers Only. Then, running this Word macro on the resulting document will find all instances of the Scrivener ID codes (and their ensuing carriage returns) and both highlight and hide them. The macro leaves show-invisibles on so you can see what it has done.

Then just make sure Track Changes is on, turn off show-invisibles and send your doc off to your editor/collaborator.

2) Reject_Hidden_Changes()

Suppose you sent your Word doc to an editor with Track Changes enabled and now have gotten it back with changes. You want to make sure none of the editor’s proposed edits will inadvertently mess with your Scrivener ID codes. This macro finds any hidden text in the document and rejects that part of any change that effects the hidden text. All changes around the hidden text are preserved. The macro leaves show-invisilbles on so can see what’s what.

At that point you can walk through your process of accepting/rejecting the editor’s edits without fear – accepting any of those changes will not touch your Scrivener ID codes.

When you import the Word doc back into Scriv your hidden codes will be duly imported, unhidden, converted to Scrivener links, and helpfully highlighted.

–gr

Sub Scrivener_ID_Hider()
    Dim trackChangesWasOn As Boolean
    ' show invisibles and turn track changes off
    ActiveWindow.ActivePane.View.ShowAll = True
    trackChangesWasOn = ActiveDocument.TrackRevisions
    ActiveDocument.TrackRevisions = False
    ' set Find & Replace params and Replace All
    With Selection.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = "\<ID*\>?"
        .Replacement.Text = "^&"
        .Replacement.Highlight = True
        .Replacement.Font.Hidden = True
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute Replace:=wdReplaceAll
    End With
    ' turn on track changes if it was on before
    If trackChangesWasOn Then
        ActiveDocument.TrackRevisions = True
    End If
    MsgBox "Done. Scrivener_ID_Hider"
End Sub
Sub Reject_Hidden_Changes()
    ' show invisibles
    ActiveWindow.ActivePane.View.ShowAll = True
    ' set Find parameters to find hidden text
    With Selection.Find
        .ClearFormatting
        .Text = ""
        .Format = True
        .Font.Hidden = True
        .Forward = True
        .Wrap = wdFindContinue
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        ' do successive find operation
         Do
            ' find (again) and process
            .Execute
            If .Found Then
                If Selection.Range.Revisions.Count > 0 Then
                 ' reject the part of any revision that is on the hidden text
                 Selection.Range.Revisions.RejectAll
              End If
          Else
              Exit Do
           End If
        Loop
    End With
    MsgBox "Done. Reject_Hidden_Changes()"
End Sub

@gr Sorry to come in so late in this discussion but I’ve been trying to figure out how to use your macros in Word.

I have copy/pasted them into a Word doc but I can’t see how to run the macro “on the resulting document”. Inside my compiled file, there is no sign of the macros in the Tools | Macros menu and if I run them in the original doc, then obviously the compiled file isn’t the active window and it doesn’t do what we need.

I guess what would be nice from a user’s perspective would be to run the macro and then pick the file it should operate on.

Any thoughts will be oh so grateful received.

Graeme

Hi, Graeme,

It sounds like you need to learn about how to create macros in Word. This is not something I can very well teach you here, but you can create new macros via that Tools > Macros menu item in Word. Macros, once made, can be made available for use on any Word doc.

Macros in Word are not Word docs, so the specification troubles you imagine do not arise. When you run one of these macros it will operate on the frontmost open Word doc.

Best,
gr

gr

Fair enough.

I’ve used macros in previous careers but I’m very rusty. I had put them in a macro section and not in the doc itself but I’ll do more investigation as to how they aren’t visible in my compiled doc.

Cheers

Graeme

Good luck. Would love to know how it works out for you.

I don’t know if this helps with your current puzzle: I think macros you make in Word get stored (can be stored) in (an internal area of) a Word template doc. Word docs that use that template will have those macros available. (This is very similar to the way custom styles are handled in Word.) So, you might have to attach the doc template to the doc you want to work with, if it isn’t already (just as you might with styles).

I don’t know if it is good practice, but I am always storing my general-purpose macros in the Normal template, so they are maximally available when working with Word docs.

Here’s a link to an old site that, partway down beginning at Step 1, explains how to set up and run a Word macro in an older version of Word. For those with Word 10 and perhaps later, the screens can be found in View/Macros/View Macros.

webbiegrrl dot blogspot dot com/2013/03/tuesday-tip-removing-hidden-bookmarks.html#more

I’ve installed the Strip Hidden Bookmarks and Strip All Bookmarks macros in Word 10. They work perfectly.

And here is a quick distillation of the steps outlined there:

Step 1: Open the Visual Basic Editor
On the Tools menu, select Macro and then the submenu for Visual Basic Editor. The Visual Basic Editor will open in a new window.

Step 2: Copy/Paste the Code
[Copy and paste the macro code] into the empty Visual Basic Editor window.

Step 3: Save Your Macro
You need to save the code … This will add it to your Normal Template so it’ll be available in all future documents you create, too. Click the disk icon OR choose “Save Normal” from the File menu

Step 4: Run Your Macro
[Exit the VBE to get back to regular Word mode (View > Microsoft Word). Open a Word doc to operate on, if not open already. You invoke your macro from the Tools > Macro > Macros menu.]

As Twolane says, these instructions will need to be adapted a bit for different versions of Word.

gr