Format pending Search & Replace

User avatar
thomas.rabenstein
Posts: 76
Joined: Wed Mar 25, 2015 12:54 pm
Platform: Mac + iOS
Location: Stuttgart / Germany
Contact:

Fri Apr 13, 2018 7:24 pm Post

Hi Scrivener team,

I'm having a hard nut to crack ...
I need to replace an expression in a huge project (1.6 Mio. words, 1870 documents) , that has been wrongly formatted.

"Techno-Fähre" shall be replaced with "Techno-Fähre".
I need to remove the italic style.

I know Scrivener 3 has not yet a format sensitive search and replace function - but is there any hint or trick you can share to run that task anyway?

Greetings,
Thomas
Friendly greetings,
Thomas
Selfpublisher

User avatar
rdale
Posts: 2118
Joined: Tue Jul 14, 2015 1:07 pm
Platform: Mac, Win + iOS
Location: St. Louis, MO
Contact:

Sun Apr 15, 2018 11:01 pm Post

The only tip I have involves Keyboard Maestro, assuming you have more than a few dozen instances of that text to de-emphasize.

I would then start with Edit->Find->Find by Formatting to do an initial search for that text in your project with the style (or character formatting, if it's not actually a "style") applied to it.
Then close the dialogue and verify that "Find Next by Formatting", from the same menu, works to find the next instance of the formatted text.
Finally, you'd set up a macro in Keyboard Mastro that performs the "Find by Formatting Again" keyboard shortcut, followed by the keystroke to apply "No Style" (CMD-OPT-0)--that's a zero, by the way, not a capital o…

Once it's established that the macro works, edit the macro to repeat these steps multiple times(10 to 20), just to save your fingers. Repeatedly invoke that macro until the search finds no more instances of the style. It'll stop changing text when it runs out of "Techno-Fähre"
FKA: robertdguthrie
AKA: R Dale Guthrie, Robert, Mr. Obscure, and "Oh, it's you again".

User avatar
thomas.rabenstein
Posts: 76
Joined: Wed Mar 25, 2015 12:54 pm
Platform: Mac + iOS
Location: Stuttgart / Germany
Contact:

Mon Apr 16, 2018 2:05 pm Post

rdale wrote:The only tip I have involves Keyboard Maestro, assuming you have more than a few dozen instances of that text to de-emphasize ...


Thank you very much for your reply.
I got a PM with a very helpful hint from another user to run this search&replace even within Scrivener.

First: I replaced all expressions in the project with an emoji.
Emojis have no style information, so I did replace all "Techno-Fähre", italic style and standard style with a :D .
After this run, I replaced the emoji with "Techno-Fähre" and got all expressions (a few thousands) in standard text style.
The only thing I had to do was converting all documents back to standard document style since the replaced font of "Techo-Fähre" did not match my editors style.

I do not need to mention: Before I performed the project wide search&replace, by emojis, I made a backup before.
But it worked. :)

No I'd like to say, to have a format pending "Search&Replace" function would be great for Scrivener.

Greetings,
Thomas
Friendly greetings,
Thomas
Selfpublisher

User avatar
rdale
Posts: 2118
Joined: Tue Jul 14, 2015 1:07 pm
Platform: Mac, Win + iOS
Location: St. Louis, MO
Contact:

Mon Apr 16, 2018 3:16 pm Post

I hadn't thought of that (or for that matter, even known that the style would be stripped from an emoji). Glad that worked well enough for you.

I agree that it would be nice if the find-by-formatting window included an option to replace, remove, or add a style.
FKA: robertdguthrie
AKA: R Dale Guthrie, Robert, Mr. Obscure, and "Oh, it's you again".