Actually, good news… Compile with replacements is already available in the latest formal release (v1.2.5) of Scrivener for Windows.
D’oh, I knew that. So it is!
That’s good news. Would e.g. $firstname1, $lastname1, etc., be useable as strings that are to be replaced at compile, or would that clash with the $@ advanced replacement feature?
@brookter - global find/replace is inadequate as it may catch things which are not intended. In MS word there is a macro function where you can place any variable you like and define it later and it’s replaced everywhere it’s used. This makes sure that all the occurrences are changed and only those occurrences are changed. A global find/replace almost requires a proofread which it not only time consuming, but fraught with peril of missing something. A placeholder/variable avoids this issue altogether.
The idea is that you give a value for the placeholder when it’s created, and that’s inserted in the text when editing. A bit higher level of service than simple mail merge.
You do realise you’re replying to a 13 year old thread?
But, why do you think you can’t do that in Scrivener?
Just decide on your variable names ($herofirstname, $herosecondname, $Whatever) ahead of time and use them in the text. Global replace them at the end, or use text replacements in compilation. Either way works and it doesn’t risk unforeseen consequences unless you used the placeholder wrongly.
Genuine question: why is that unworkable and the Word version isn’t?
| You do realise you’re replying to a 13 year old thread?
I was tying in a new post, and the AI suggested that it sounded like this post. So I aborted and read that post. Didn’t look at the dates.
| But, why do you think you can’t do that in Scrivener?
I’ve looked for this feature in Scrivener before, and didn’t find it beyond the canned placeholders. I looked up the Scrivener docs and it talks all about the canned placeholders, but nothing about custom placeholders.
| Just decide on your variable names ($herofirstname, $herosecondname, $Whatever) ahead of
| time and use them in the text. Global replace them at the end, or use text replacements in
| compilation. Either way works and it doesn’t risk unforeseen consequences unless you used the
| placeholder wrongly.
As pointed out in the discussion, using raw placeholders (aka mail merge) disrupts the writing process. The placeholder needs to be filled in in real-time, and not at compile time so that the text flow and cadence can be assessed.
| Genuine question: why is that unworkable and the Word version isn’t?
In Word it’s called a macro and it appears in the text akin to < < John > > and hover reveals it as a macro with options. I suppose creative naming of placeholders such as $john, $george, $paul, $ringo would go easier than $herofirstname, etc. with a little planning. Also, Word is WSIWYG while Scrivener is not (more like TeX, actually.) But, it would be hoopy if one could define a placeholder, give it a value (easily) and see it in the written text as its value. Then I could go “Does that really work?” at the time, rather than wait until typesetting (compiling.)
But - even looking at the help documentation with version 3.1.5.1 on placeholders, there’s still no guidance on how to just define a $herofirstname, at least that’s apparent.
So, how is this done?
Again, it’s just a suggestion.
Decide you want say, $John as the variable name. Every time you want to use it, you just type $John. (Doesn’t have to start with a $ – any unique marker will do, of course.)
Then at compilation time use the text replacement feature. If you want to keep John as the name, then you’d add John as a replacement; if you want to change it to Peter, do that, as in the screenshot below.
You have a few options: regex, case-sensitivity and whole-word. Unless you want to do something complicated, then it’s simple enough, I think.
Or use global search and replace, of course.
HTH.
Project Replace is the way to go. It’s not inadequate, but a user is required to make the right selections when wanting to replace names (or any other text for that matter), else they end up replacing content that is part of other words. It takes about 5 seconds on a 300,000 word project.
You just made my point. Global find/replace is a sledgehammer when a scalpel is needed. After the replace, careful and full proofreading is required to ensure that 1) every replacement was indeed made, 2) only the replacements wanted were made, and 3) that the text still makes sense. As a writer who has worked on many complex technical projects where specs change, products change, names change, etc. using global find/replace was always a minefield. Word macros fixed all that - very useful and would like to see it here as well.
- every replacement was indeed made: Yes, according to logic.
- only the replacements wanted were made: Yes, selection criteria must be correct (typically Whole Word).
- that the text still makes sense: Yes, it will if Whole Word is replaced, not Whole Word, plus random spaces a user might insert after a word.
I’ve made the odd mistake, and although the change is not recoverable, that’s what backups are for. So, no major disaster I can’t fix in a few minutes–the need to just endlessly write and nothing else is exaggerated-- and probably bad for your health. I think you’re looking for an over-complicated solution.