Rename .htm to .html

This forum is for all Flare issues related to the Microsoft HTML Help target.
This target produces "CHM" files in the output.
Post Reply
TeSol
Sr. Propeller Head
Posts: 114
Joined: Wed Sep 14, 2011 12:02 am

Rename .htm to .html

Post by TeSol »

Hi,

Will there be any problem if I rename .htm files to .html? My developer has called .html files in the application; changing to .htm will mean changes in several files. It may be easier for me to make the change at Flare's end. One problem I will have is that the TOC will need to be redone. But apart from that, will there be any other problems? Is it safe for me to rename the files without causing too much damage?

Any thoughts on this would be appreciated.

Thanks.
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: Rename .htm to .html

Post by i-tietz »

You can edit project files in the text editor and use a Find&Replace.
Topic file name can be changed in the DOS prompt that Windows offers.
The links to those topic files in other topics you can also change be a Find&Replace for "whole project'".

PROBLEM: Adding topics defaults to .htm again - you will have change that EVERY time.
Inge____________________________
"I need input! - Have you got input?"
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Rename .htm to .html

Post by LTinker68 »

I don't have Flare open at the moment to check, but I think there's someplace in the project where you can specify the file extension that's used at build time. It's so you can specify .aspx, for example, although I seem to recall an option to set it to .html. The option is probably either in the skin or the target.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
wclass
Propellus Maximus
Posts: 1238
Joined: Mon Feb 27, 2006 5:56 am
Location: Melbourne, Australia

Re: Rename .htm to .html

Post by wclass »

LTinker68 wrote:... there's someplace in the project where you can specify the file extension that's used at build time ...
Look in the target, on the Advanced tab, and there is a checkbox to "Use Custom file extensions for output". Just type in html - no dots, no quotes. This does not change your source file names, but just puts the extension in when the webhelp is generated.
Margaret Hassall - Melbourne
TeSol
Sr. Propeller Head
Posts: 114
Joined: Wed Sep 14, 2011 12:02 am

Re: Rename .htm to .html

Post by TeSol »

Thanks everyone. I learnt something new today - did not know about custom file extensions during output generation.

Only thing is, that is an option during generation of Webhelp; and I am looking at CHM file generation. Looks like it will have to be manually done..?

Regards,
TeSol
wclass
Propellus Maximus
Posts: 1238
Joined: Mon Feb 27, 2006 5:56 am
Location: Melbourne, Australia

Re: Rename .htm to .html

Post by wclass »

TeSol wrote:... Only thing is, that is an option during generation of Webhelp; and I am looking at CHM file generation.
I'm confused. How is your developer calling HTML instead of HTM if you have a CHM? Wouldn't they just call the .CHM file?
Margaret Hassall - Melbourne
TeSol
Sr. Propeller Head
Posts: 114
Joined: Wed Sep 14, 2011 12:02 am

Re: Rename .htm to .html

Post by TeSol »

Yes, but for context sensitive help, they would call the .html file.
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Rename .htm to .html

Post by RamonS »

Which .html file? I know that the CHM contains html files, but why not use map IDs or aliases instead? That is much easier than using sth like mk:@MSITStore:C:\WINDOWS\start.chm::/start.html ...and you are free to change file names and file locations without the need to have a developer change the code.
BrianBAtCeres
Propeller Head
Posts: 13
Joined: Fri Jun 12, 2015 1:57 pm
Location: Thousand Oaks, CA
Contact:

Re: Rename .htm to .html

Post by BrianBAtCeres »

I'm bumping this thread since I'm in the same situation as TeSol. In other words, the developers need a compiled help file (.CHM) and they link their help buttons to HTML page names and not map IDs or aliases. I was just wondering if anyone has found a simpler way other than renaming the files manually.
RamonS wrote:Which .html file? I know that the CHM contains html files, but why not use map IDs or aliases instead? That is much easier than using sth like mk:@MSITStore:C:\WINDOWS\start.chm::/start.html ...and you are free to change file names and file locations without the need to have a developer change the code.
I have no idea why it was set up that way. However, every place I've worked has had an odd way of integrating help so I'm not too surprised. :| (At one place I worked I had to modify the application code.) Hopefully, in the future they'll go to a more logical way (e.g., map IDs).
:flare: MadCap Flare v11, :capture: MadCap Capture v7
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Rename .htm to .html

Post by kwag_myers »

I haven't worked with CHM files in years, so I'm not sure this is going to help you. But you can easily change file extensions of your source files with this Visual Basic Script:

Code: Select all

'Change to .html
Const CHANGE_FROM = ".htm"
Const CHANGE_TO = ".html"

'Var Declaration
Dim srcFolder
Dim objFSO, objFolder, oFolder
Dim colFiles

'Source Folder - change to your source files
srcFolder = "C:\Users\kwag.myers\Documents\Project\Content" 

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(srcFolder)
Set colFiles = objFolder.Files

' Changes Files Extensions in Source Folder
ChangeExtension colFiles

Sub ChangeExtension(collectionSet)

Dim objFile

For Each objFile In collectionSet
    If InStr(objFile.Name,CHANGE_FROM) Then
        objFile.Name = Replace(objFile.Name,CHANGE_FROM,CHANGE_TO)
    End If
Next
End Sub
Paste that into NotePad, save it with a VBS extension, and double-click when you need it. Flare keeps the HTML extension in the output. I was a little worried that the script would see the first three letters of the HTML extension and keep cycling, giving me .htmhtml, but it worked in testing.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
BrianBAtCeres
Propeller Head
Posts: 13
Joined: Fri Jun 12, 2015 1:57 pm
Location: Thousand Oaks, CA
Contact:

Re: Rename .htm to .html

Post by BrianBAtCeres »

Thanks kwag_myers! I will give it a try.
:flare: MadCap Flare v11, :capture: MadCap Capture v7
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Rename .htm to .html

Post by kwag_myers »

One thing I noticed this morning is that using the script repeatedly doesn't work as well as I first thought. Instead of *.htmhtml, I had *.htmll. So, you have two options for adding new topics:

1. Have two versions of the script with the second version set to look for the double L. When you run the first script to fix any new files, you'll need to run this second script to fix the existing files:

Code: Select all

Const CHANGE_FROM = ".htmll"
2. Change the new file(s) manually.

Also, I noticed all the links in the TOC were broken, so you'll have to update those (manually I believe). However, links within the topic files can be updated with Flare's Find and Replace feature.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Post Reply