OS-dependend CHMs

This forum is for all Flare issues related to the Microsoft HTML Help target.
This target produces "CHM" files in the output.
Post Reply
RDieter
Propeller Head
Posts: 10
Joined: Thu Apr 02, 2009 7:13 am

OS-dependend CHMs

Post by RDieter »

Hello everyone,

I have the following question: Is it possible to build a chm which contains os-dependent content (especially TOC & content/topics). The current situation is like the following:
3 Target definitions (WinXP, Vista, 7) which contain the specific content for each OS with different conditions. The problem is: We get 3 CHMs, which works but more and more is annoying due to the fact that we want to reduce the file size of our software, and 3 duplicate CHMs are more or less unneeded.

Do you have an idea how we could get this to work? We need some topics and TOC entries not shown in XP chm (since our software doesn't support stuff under XP).

Thanks for your ideas!

/e:
WE HAVE: help_XP.chm, help_vista.chm, help_7.chm
WE WANT: help_anyos.chm
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: OS-dependend CHMs

Post by LTinker68 »

You can certainly build different outputs using conditions, but which one to install I would think would be part of your installation process. So your installation program would only install the version appropriate to that user's OS, as detected by your installation program.

But if you're trying to keep your installation program size down, then why not offer different downloads from your site? There are numerous software companies that, before you download, ask you what operating system you're running so they can give you the appropriate file to download. (I'm assuming you're not talking about installing from a CD.) You'd have to build multiple installation programs, each with the appropriate CHM included.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
RDieter
Propeller Head
Posts: 10
Joined: Thu Apr 02, 2009 7:13 am

Re: OS-dependend CHMs

Post by RDieter »

Thank you for your reply. Yes, we want to keep the installation file as small as possible. Unfortunately, it is not possible to offer multiple installation programs just because of different help files. I don't think that our customers will like that kind of thing... If you would know our software you would know why.
Anyways, thank you. Hopefully, Flare 6 will have a new customizable dotnet help output...
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: OS-dependend CHMs

Post by RamonS »

How large is the installer file right now and how do you distribute it? Do you include anything that could be obtained otherwise?

At my work we used to create CDs that contain SQL 2005 with a scripted installer that set everything up for the customer. SQL 2008 comes around and it not only no longer fits on a CD with our applications, we'd also need to create a new installer. Aside from that, if we ship CDs or manuals we have to collect sales taxes. Additionally, the majority of customers download update packages and anyone who needs the entire package downloads it once, which isn't a big deal using broadband. I currently work on a document for SQL 2008 installation. Once the prerequisites are in place installing SQL 2008 using the web installer was surprisingly easy. Now we no longer drag around this fat pig of SQL Server, have customers download it from Microsoft, have Microsoft pay for the bandwidth (and they have a bigger pipe anyway, so it is faster), and clearly show them that Microsoft provides SQL Server, not us.

You may want to investigate if in your case some third party components can be "outsourced" from the installer, such as .NET runtime, SQL Server, PDF reader, etc. If you used CDs so far, maybe going to DVD is feasible. The only case I can think of where size still matters a lot is for really remote sites that only have dial-up (and there are still very many of those in the US).

The customizable DotNetHelp most likely will not fix your problem because I doubt that it will be that customizable. You may be able to add some tricks through code and make it work.
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 131
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Re: OS-dependend CHMs

Post by TheGreatAndPowerfulOz »

RamonS wrote:You may be able to add some tricks through code and make it work.
RDieter,

If you are comfortable enough with JavaScript, you might consider using the following code (or something similar) to detect which OS is being used, then cause certain content to be visible in your topic(s), based on the result:

Code: Select all

/* -------------------------------------------------------------------------------------------------------- **
** Determines which client is being used
** -------------------------------------------------------------------------------------------------------- */

	var ua = navigator.userAgent.toLowerCase();
	// <START> for IE8 detection only
	var rv = -1;
	var re = new RegExp('trident\/([0-9]{1,}[\.0-9]{0,})');
	if (re.exec(ua) != null) {
		rv = parseFloat(RegExp.$1);
	}
	// <END> for IE8 detection only
	var client = {
		isStrict:		document.compatMode == 'CSS1Compat',
		isOpera:		ua.indexOf('opera') > -1,
		isIE:			ua.indexOf('msie') > -1,
		isIE7:			ua.indexOf('msie 7') > -1,
		isIE8:			rv == 4,
		isBorderBox:	ua.indexOf('msie') > -1 && document.compatMode == 'CSS1Compat',
		isSafari:		/webkit|khtml/.test(ua),
		isSafari3:		/webkit|khtml/.test(ua) && !!(document.evaluate),
		isWindows:		ua.indexOf('windows') != -1 || ua.indexOf('win32') != -1,
		isXP:			ua.indexOf('nt 5.1') != -1,
		isXP64:			ua.indexOf('nt 5.2') != -1,
		isVista:		ua.indexOf('nt 6.0') != -1,
		isWin7:			ua.indexOf('nt 6.1') != -1,
		isMac:			ua.indexOf('macintosh') != -1 || ua.indexOf('mac os x') != -1,
		isLinux:		ua.indexOf('linux') != -1,
		isGecko:		ua.indexOf('gecko') != -1 && /webkit|khtml/.test(ua),
		isFirefox:		ua.indexOf('gecko') != -1,
		isIPhone:		ua.indexOf('iphone') != -1 || ua.indexOf('ipod') != -1
	};

	var IE8 = client.isIE8;
	var IE7 = client.isIE7 && !client.isIE8;
	var ltIE7 = client.isIE && !client.isIE7 && !client.isIE8;
	var IE = client.isIE;
	var FF = client.isFirefox;
	var Win = client.isWindows;
	var WinXP = client.isXP;
	var WinXP64 = client.isXP64;
	var WinVista = client.isVista;
	var Win7 = client.isWin7;
	var IP = client.isIPhone;

	/* for debugging purposes */
	// alert(navigator.userAgent.toLowerCase());
	// alert('Windows: ' + Win);
	// alert('Windows XP: ' + WinXP);
	// alert('Windows XP 64-bit: ' + WinXP64);
	// alert('Windows Vista: ' + WinVista);
	// alert('Windows 7: ' + Win7);
	// alert('IE: ' + IE);
	// alert('IE8: ' + IE8);
	// alert('IE7: ' + IE7);
	// alert('ltIE7: ' + ltIE7);
	// alert('FF: ' + FF);
	// alert('iPhone: ' + IP);
You'll see that I've declared a bunch of variables (e.g., "var IE8", "var IE7", "var Win", "var WinXP", "var Win7", etc.) for the environment elements upon which I might be interested in basing conditional JavaScript statements; you can declare as many or as few as suit your needs.

For testing purposes, you can create some commented "alert" statements similar to mine, then just un-comment one or more to make sure the code is detecting your environment properly.

Once everything seems good, you could use code similar to the following to show/hide content in your topic(s):

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd">
	<head>
		<script type="text/javascript" src="MyJavaScriptFile.js">
		</script>
	</head>
	<body>
		<p>
			<script type="text/javascript">
				if (WinXP) {
					document.write('My Windows XP content');
				}
				else if (WinVista) {
					document.write('My Windows Vista content');
				}
				else if (Win7) {
					document.write('My Windows 7 content');
				}
			</script>
		</p>
	</body>
</html>
Of course, this is an ultra-simplified example. You could do all sorts of fancy-pants stuff with JavaScript to get the appropriate content in place within your topic(s), but this just shows one way to use the conditional statements.

All that being said, I think this would only help as regards your OS-specific topic content. I'm not sure how you'd go about altering your TOC items based on the OS in use. Maybe you could just make "generic" TOC items whose associated topics would display the OS-specific content using a method like the one I've shown (??).

Good luck!
Austin Wright

Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: OS-dependend CHMs

Post by RamonS »

My comment was in reference to DotNetHelp and in that case I'd do it through DotNet code and not through JavaScript. Nevertheless, Oz's code may work right now in CHMs and is surely worth a try. Just make sure that things like full text search don't pick up on portions that are not intended for the applicable OS.
If you have entire topics that are different rather than just sections within a topic you may need to consolidate the different topics into one. Otherwise you need to figure out how to customize ToC, Index, and Glossary on the fly.
Post Reply