Taking custom tags from a page in the project

Hello
I’m a new user of scrivener 3 for Mac.
I use it to write product manuals (machines, equipment) and my works are sent to my clients in Word or PDF format.
I want create a page and define in it some custom tags with terms which will be repeated in whole project.
Then I want use each of them when a proper word occurs in the text with placeholder <$custom:…>.
Position of these words is different along documents inside the project.
Is it a was to do this?
Thank you

Hi.

I am not sure I fully understand what you are trying to achieve, but if it is only a matter of having the placeholder inserted wherever the word appears, you could do it once you are done with the content development by using project replace. (Edit/Find/Project Replace)
Replace word with word-<$YourDesiredPlaceholder>

In addition to the idea expressed by @Vincent_Vincent , there also is the text “replacements” option in the Compile settings. Here is a screen shot of a simple example I use:

1 Like

I was gonna edit this into my reply, but I am not sure if it isn’t too late in the chain for the placeholder to act as it should? (Get replaced with the target?)

If it works that’d be more convenient as you (@Redbaron) wouldn’t have to bother with it more than setting it up once.

@rms and @Vincent_Vincent
Thanks a lot for your replies. I try to explain.
In other softwares these are defined as variables.
Some words which identify Producer, Model, Serial number are defined when I start a new manual.
Other are defined during writing so I think it’s easier define placeholder and immediately assign the meaning as a custom tag in the document where I collect all of them.
I’m trying but without results.
Another problem I have concerns part of text which are repeated along the manual, for example Hazard - Special instructions. The previous software I was using (Help+manual) called these parts as snippets. You can record one time and then insert everywhere you need.

So, create a new Scrivener project, in the text use, say PRODUCER, MODEL, SERIALNUMBER in the text and then in the compile settings change those key words to what you want. If you don’t like PRODUCER and you want to use something fancier, go ahead. When the document is compiled it will replace all instances as you setup. Can’t see how it can get any easier.

There might be a fancier Scrivener way, but nothing comes to mind. I’d consider putting that text into a document in “References”, then when time to insert them everywhere you need, then use macOS copy/paste.

Or use the same Replace feature but the "with"field is small and perhaps unwieldy. But that way is automated.

Edit: Just remembered the <$include> placeholder which allows you to insert text. I see that in the documentation, but haven’t ever done it (far as I recall). Give it a go.

FWIW, this kind of application is why the <$include> placeholder exists.

1 Like

Thank you to all, your replies are very helpful for me.
I was using different softwares in Windows because in my previous job this was the solutio but now I prefer Mac platform.

Scrivener does loosely support the notion of variables, that is data that can be extracted from one item and injected into others. These can operate as a kind of “global variable”, and you’ve struck upon the right idea for that: having a section somewhere—anywhere, it doesn’t need to be in the Draft folder—that defines what should be global, and everything else pulls from that item.

For the necessary ingredients, refer to §10.1.4, in the user manual PDF, under subheading Combining Links with Placeholders. The idea is really simple though:

  1. Type in the placeholder you want to extract data for, such as a <$custom:...> value.

    This works for any placeholder in the document placeholder list of the cheatsheet in the help menu. Title, synopsis, label, modification date, etc. There are a few others it can redirect content from, such as <$include> and <$p> (to insert a page numbering field).

  2. Select it, and drop your “global variable” item onto the selection, which creates a link to it.

To make the latter part easier, I suggest adding this item to your Project Bookmarks list, or opening it as a Copyholder and shrinking it down. Either approach can be as efficient for having something to drag and drop to create the link (pretty much every icon you see can be dragged, like the one in the Copyholder pane). Both the Bookmarks pane in the inspector and the Copyholder make it easy to edit content, so you can add notes to this item if desired. The main advantage to the Copyholder though, specifically to what you’re doing, is that when you click into it the Inspector will inspect it, meaning access to your custom metadata assignments for it.

By the way, we make the user manual project available as a demo of some of the more advanced things Scrivener can do. I use this technique extensively in the manual. For example almost all of the menu commands in the software are listed in a big tree view for the appendix entry on them, and I record each Mac/Win shortcut into these command entries. Thus when compiling all of the up-to-date keyboard shortcuts are injected into the many hundreds of places throughout the manual they are used.

Not demonstrated in that sample project is further augmentation, done by compile Replacements, which takes an actually non-existent metadata placeholder (<$custom:Shortcut>) and transforms it on the fly to one of the actual custom metadata fields that stores either the Mac or Windows shortcut. This replacement is stored in the compile formats that handle Mac/Win output.

So that’s how you can make variables even more variable, and less like constants, if that’s what you need!

The include placeholder can also be handy for this kind of stuff. I use both, depending on what I need for the purpose. For example there are footnotes that have formulaic text in them, like the hint that one can use Project Templates to store project level settings or configuration options that the manual is discussing in that area. So for something like that, injecting a short sentence into dozens of separate footnotes, it is an superior approach over using metadata itself, as I can have any number of these “snippets” without clogging up the inspector sidebar.

As noted above, Replacements certainly also can operate in the variable space as well. I tend to use that less, mainly because the more of those you add the slower compile gets (as you might expect given the above example on how a replacement can actually generate a placeholder, which can then get replaced further, these run more than once during compile). It’s probably not something to worry about too much unless there are many dozens or hundreds of them, particularly any that would use RegEx, for obvious reasons.

The other reason I prefer includes and linked metadata placeholders is that I don’t have to open and close compile to reference my ‘cheatsheet’ or modify the list. Again it’s a matter of scale. It takes about five seconds to load the compile window in the user manual project, because its Draft folder has close to 3,000 binder items in it, and then have to remember whether what I’m looking for is a global project replacement or one that is specific to a compile format (and then load that in another window). Not everyone is going to run into that problem though!

2 Likes