Find & replace style with style plus conditional text

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
Jens Krieger
Posts: 8
Joined: Sun Jun 25, 2017 8:24 pm

Find & replace style with style plus conditional text

Unread post by Jens Krieger »

Hi,

I was browsing the forum but didnt find an exact match, hence my post. Sorry if I missed the one...
We've imported an Robohelp generated cmh file (the project import didnt work as good as the chm one for some reasons...), containing quite a number of topic links, always the same wording, always the same style. They work nicely for the chm, but I would like to omit them for the PDF (or Word) export. I can work with e.g. IFNOTPDF...ENDIF, but the project consists of about 500 topics with at least one occurence of the topic link...so thats a hell out of work doing it manually.

So, is there a way to apply a conditional text to a certain style or what would be the preferred way to do it?

Thanks a lot in advance,

Jens
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Find & replace style with style plus conditional text

Unread post by Tim Green »

Hi Jens,

You can't do this directly in Help+Manual. However, it's quite easy to do by searching and replacing in the source code of the XML if each link is exactly the same. You just need to make the change manually once and check the before and after code in the XML source code tab of the topic to get what you are looking for and what you need to replace it with. Then use any multi-file search and replace tool to perform the operation on the topic XML files in the Topics folder in your uncompressed HMXP project.

For example, you can do this with the free Notepad++ editor, which has a good multi-file search and replace function that also supports regular expressions if you feel comfortable with them. The Premium Pack Toolbox power tools utility included with the current Premium Pack can do the same thing on both uncompressed and compressed projects, with five different search modes, also with regular expression support.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Jens Krieger
Posts: 8
Joined: Sun Jun 25, 2017 8:24 pm

Re: Find & replace style with style plus conditional text

Unread post by Jens Krieger »

Hi Tim,

thanks for the swift reply. Much appreciated. I'll give it a try with NP++, otherwise it for sure a good argument investing in the Premium Pack. Sounds pretty comfortable.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Find & replace style with style plus conditional text

Unread post by Tim Green »

Jens Krieger wrote:thanks for the swift reply. Much appreciated. I'll give it a try with NP++, otherwise it for sure a good argument investing in the Premium Pack. Sounds pretty comfortable.
PP Toolbox can also save complex searches in a profile file that you can load. For example, if you wanted to conditional tag similar but not identical links I could create a regex profile for you and you'd just have to load it to be able to use it.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Jens Krieger
Posts: 8
Joined: Sun Jun 25, 2017 8:24 pm

Re: Find & replace style with style plus conditional text

Unread post by Jens Krieger »

Another argument for PP toolbox... ;-)

However, I'm currently fighting with my legacy knowledge of reg exp - it has been quite some time but I try to be ambitious...I'll give it a chance this evening before I will admit my defeat :-)
Jens Krieger
Posts: 8
Joined: Sun Jun 25, 2017 8:24 pm

Re: Find & replace style with style plus conditional text

Unread post by Jens Krieger »

Took me a little bit but my regex knowledge comes back. Thanks for the hint with NPP, especially with the regex plugin to test the regex it works like a charm.

Thanks again for the swift and helpful reply. Very good application and forum.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Find & replace style with style plus conditional text

Unread post by Tim Green »

Jens,

If you're willing to spend a couple of euros, get RegexBuddy from Simply Great Software:

https://www.regexbuddy.com/

It is the best tool on any platform for developing and testing Regexes, supports all known Regex flavors and is generally simply awesome. In addition to this the help is the best tutorial on regex that you will find anywhere. Along with their PowerGREP program these are two of the most essential software tools I have. Can't praise either of them highly enough. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply