Another Syntax Question

How can I change:

“### Header Three”

to a styled (as in Paragraph Styles, see illustration) Header 3? There are 250 instances, so making the change manually is…tedious.

There is no cure for that, I’m pretty sure.

Here is the fastest way to do it (I think).
You might want to backup your project first.

image

Hit “delete” on your KB.
Then click “next” in the Find dialog… and repeat.
(Next-Heading1-delete-Next-Heading1-delete-Next-Heading1-delete-Next-Heading1-delete-…)

You can have your whole project as a single scrivening, and patiently do everything in one pass.
Should take you no more than about 30 minutes.
Then, have a coffee, and forget you ever had to do that.

P.S. I did a little mistake in my example : You might want to include the space after “### Header three” in the “Find:” dialog, so it gets deleted too.

→ I used Heading 1 in my screenshots for better visibility. You, of course, assign the style of your choosing.

  1. Go into Scrivenings for the whole document;

  2. Enter ### in the Search bar at the top of the window, tap return and in the dropdown click “Whole project search”;

  3. From the Styles dropdown menu, choose your Heading 3 style.

  4. You can then get rid of the hash-marks if you want by doing a regular “Search and Replace All”, but don’t forget to include the space following the hash-marks.

:slight_smile:

Mark

@xiamenese
I just tried your way, but I can’t get it to work…
Perhaps you missed a step in your explanation or something ?
(Could be that I am running the Windows version tho (?) )

After project search, I get the style selection grayed out.

Maybe it’s not possible on windows because of the way Scrivenings works (or not really :wink: ) on Windows. As @pseingalt is a Mac user, it should work for him. I’ve just been testing it.

:smile:

Mark

I added that to my list of “reasons I’d be happier owning a Mac”.
But now I can’t open that list’s project no more…
I get this error message :
“ERROR 2763 {oversized project}”
What to do ???

1 Like

@Vincent_Vincent ‘s suggestion can be sped up by using keyboard shortcuts. After the initial Find, use cmd-G to Find Again, and that will walk you through the instances. If you assign a temporary shortcut (using sys prefs > keyboard > keyboard shortcuts > app shortcuts) to your desired style (say, cmd-opt-Z), then your process would just be cmd-F, cmd-opt-Z, then a repeating sequence of cmd-G, cmd-opt-Z. Choose a shortcut without the option/alt key for even faster action (I just don’t know off hand what straight cmd- might be available off hand.)

2 Likes

Same is true with my (Mac) solution, if you have a shortcut set for that style — being on a Mac, I have headings set to Ctrl-1, Ctrl-2 etc. So in fact my solution comes down to

type 3 #s in the search bar
Return
click Full Project Search
Ctrl-3.

But as your hand has to be on the mouse for step 3 anyway, it’s no big deal to use the dropdown.

:smile:

Mark

Step 2 doesn’t select anything. All it does is reduce the Binder to documents where Scrivener finds hash marks. Step 3 won’t do anything, because the styles menu is disabled until your cursor is in the text. If you click in the text and try step 3, it doesn’t work because the matches are only highlighted, not selected.

Here’s a macro (Keyboard Maestro) for doing a similar thing – finding main character names and setting them to a character style.

  1. Type Kelly|Kell|Grey|Cardiff|Gretel in the project search box (RegEx search)
  2. Click in the Binder.
  3. ⌘A to select the matching documents
  4. Click in the Editor (before the first match)
  5. ⌘F (so that ⌘G will do future searches)
  6. Again, click before the first match.
  7. ⌘X to find a match and apply the style
  8. repeat ⌘X until the search wraps around (tedious but easy)

The disabled delete action would apply to the hashtag issue, but not to my character styles usage.
⌥⌘0 applies No Style in case the name has already been styled
⌥⌘5 is the shortcut for the character style

It worked on my machine (Intel iMac running Monterey 12.2.1), yesterday … the hash-marks were selected and the menu was not greyed out as my screenshot shows.

On further testing, there are times when it does and times when it doesn’t, but it’s too late now for me to spend time on it.

Here’s a video (M1 Monterey 12.2.1):

steps 1, 2 don’t make step 3 possible