Changing File Names to Lowercase

What's covered?

This topic covers how to change all the links in your topics to lower case.

 

From time to time, the need to change webhelp file names to lower case arises.

There are four parts to the work involved. RoboHelp needs to be kept closed during all of them.

  1. Changing the file names where they appear in hyperlinks
  2. Changing the file names anywhere else they appear in the project.
  3. Changing the file names themselves.
  4. The MPJ / CPD File

Do read ALL the sections before you start.

Changing the file names in hyperlinks

Do not consider doing this unless you have a good backup.

The only way I can see of doing this, apart from the painful method of going into every topic and manually editing, is to use Regular Expressions. It is outside the scope of this topic to give a tutorial on that subject. For those not familiar with Regular Expressions, they are a formula for finding strings where the content is variable. The expression

<a href=".+.htm">

should find any hyperlink and you then need to set your regular expression program to replace what is found with lowercase. You need to preview the changes to make sure that nothing else is changed.

I use PowerGrep for this and I know others use a program called BKReplaceEm.

Changing the file names elsewhere in the project

Do not consider doing this unless you have a good backup.

This may vary from project to project so you need to find every file that contains references to file names. The easiest way is to create a topic with a unique name and then search through all files in the project.

I created a topic called Redrabbit.htm. It's a trick I have used before as I have yet to find a real help file with a topic about red rabbits!

Next I searched through all the files in the project to find any that contained a reference to Redrabbit.hm and again I used PowerGrep. BKReplaceEm would do the same job as would various programs you can find.

You need to exclude these file types from the search, fla, swf, jpg, gif, chm and cpd.

Apart from hyperlinks, I found Redrabbit.htm in the following files.

FlashHelp.ssl, WebHelp Pro.ssl and WebHelp.ssl.

The only filename in these files is whatever you generate the help to. It is only one line to change and I suspect changing the filename when you next generate would change the file anyway.

Root.fpj

This is really an xml file and it would be easy to write a regular expression to make the changes. For those not into regular expressions, the whole line that contains the filename could be selected and changed to lowercase with a decent text editor. Depending on the number of files, the second option could be a bit tedious.

ProjectName.hhc

Virtually the same as [2] but the line with the file name also contains the word "Local". Not a problem with regular expressions but the text editor method would require a case sensitive search and replace to change "local" back to "Local", although it might not matter.

ProjectName.hhp

All the file names are in one section so just select that section and use the text editor to change the case.

ProjectName.pss

Several lines that need amending either manually or by using the text editor to do it.

Changing the file names themselves.

Do not consider doing this unless you have a good backup.

For this you need to find a utility that will change all the file names in a project and that can limit that action to the HTML files.

I looked at a few and my choice was Batch File Renamer 2.5.1 from

www.freewarefiles.com

It allows better control over what is changed than the others I looked at. The choice is, of course, yours and you won't run the utility without a backup, will you?

The MPJ / CPD File

Do not consider doing this unless you have a good backup.

Depending on which version of RoboHelp you are using, your project will have one of these files. Up and including X4 will have an MPJ file and X5 has a CPD file.

The MPJ File

This one is the more difficult to deal with.

You can delete it and reopen your project by double clicking the HHP file. Because you have changed the case there, the MPJ will be rebuilt with lowercase file names.

As I said you CAN delete it. You CAN also delete the Windows directory from you hard disk, but it might not be a smart move. Whether you want to delete it depends on your project. I recommend that you visit Rick Stone's site at www.robowizard.com. Download his TipsNTrix and look at the topic on rebuilding MPJ files.

If you do decide to rebuild the MPJ file in this way, rather than deleting it, move it somewhere else so that you can roll back if things go wrong.

If you decide not to delete the MPJ, there are alternatives.

  1. Open the MPJ file with Microsoft Access 97. That is the correct version for all MPJ files (and indeed the CPD file in X5). Use something like Macro Express to cut the file name from the Topic File table, paste it into a text editor, change the case and paste it back into Access. Klunky but it does work and surprisingly well if you set up a good macro.
  2. Open the MPJ file with Microsoft Access 97 and manually change the names.
  3. If you do not have Access 97, you could try opening the file in a later version of Access, making the changes, and then saving back as an Access 97 database. I haven't tested that but it should work.
  4. Write some VBA in Access to make the change.

The CPD File

RH state that this file can be deleted and will be rebuilt when the project is reopened but unlike the MPJ file, you will not lose anything. That is the experience of most people although one person reported otherwise. There is more detail on that under Snippets. Whilst it seems likely that is a one off, there can be no guarantees. However, you will have a backup won't you? If you prefer you can edit this file in the way described for the MPJ file.

Test

You should be able to reopen the project and rebuild your output. Test it thoroughly!

Good luck and remember, it is a process where you have to be very methodical.

For what it is worth, I did this in a project with over 10,000 files and it is still working two years on.

 

Date

Changes to this page

24 Jul 2004

New topic. Many thanks to Craig Clarke and Rick Stone for their input and testing.