Website To CHM

Put your website in a chm file

Just choose a folder and all html files found will be put in a single compressed CHM file including graphics, scripts, applets…
Very usefull to show a website offline on a floppy disk
Note : chm files are standard help files in windows,
You can find an example generated from this script there

File Name : chm.vbs
Requirement : HTML Help Workshop
Author : Jean-Luc Antoine
Submitted : 06/09/2001
Category : 4K
Preview : Click here !
option explicit
'The generated CHM file is named jla.chm on your desktop.
'Your folder hosting the files has not to be on c:
Dim WshShell,fso
Dim HHC,RepBase,FicHHP,t,c
Set WshShell=WScript.CreateObject("WScript.Shell")
Set fso=CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Err.Number=0
HHC=WshShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\HTML Help Workshop\InstallDir")
If Err.Number<>0 Then
	Wscript.Echo "In order to use this script, you need HTML Help Workshop" & _
	vbCrLf & "http://msdn.microsoft.com/library/en-us/htmlhelp/html/vsconhh1start.asp"
	wscript.Quit
End If
On Error Goto 0
HHC=fso.BuildPath(HHC,"hhc.exe")

If Not fso.FileExists(HHC) Then
	Wscript.Echo "Warning, the workshop is registered but the compiler was not found"
	WScript.Quit
End If

If 1=MsgBox("This script creates a .CHM file on the desktop from a folder having lots of html files.",1) Then
	RepBase=B("Choose the folder hosting your website")
	If IsNull(RepBase) Then
	    MsgBox "Please choose a Folder"
	Else
		T=Recurs(RepBase)
		FicHHP=fso.BuildPath(RepBase,"JLA.HHP")
		Set c=fso.CreateTextFile(FicHHP,True)
		c.WriteLine "[OPTIONS]"
		c.WriteLine "Compatibility=1.1 or later"
		c.WriteLine "Compiled file=" & fso.BuildPath(WshShell.SpecialFolders("Desktop"),"jla.chm")
		c.WriteLine "Default topic=" & Mid(Debut(T),Len(RepBase)+2)
		c.WriteLine "Display compile progress=No"
		c.WriteLine "Language=0x40c Français (standard)"
		c.WriteLine "Title=(c) 2001 JLA"
		c.WriteLine vbCrLf & "[FILES]"
		c.WriteLine T
		c.WriteLine vbCrLf & "[INFOTYPES]" & vbCrLf
		c.Close
		Set c=Nothing
		'wshShell.Run "notepad.exe " & FicHHP,3 ,-1
		wshShell.Run Chr(34) & HHC & Chr(34) & Chr(32) & FicHHP,3 ,-1
		fso.DeleteFile FicHHP
	End If
End If
Set fso=Nothing
Set WshShell=Nothing

Function B(Msg)
	Dim a,f,i
	Set a=WScript.CreateObject("Shell.Application")
	On Error Resume Next
	Set f=a.BrowseForFolder(&H0&, Msg, &h1&)
	B=f.ParentFolder.ParseName(f.Title).Path
	If Err.Number<>0 Then
		B=Null
		If f.Title="Desktop" Then B=WshShell.SpecialFolders("Desktop")
		i=InStr(f.Title,":")
		If i>0 Then B=Mid(f.Title,i-1,2) & "\"
	End If
	Set a=Nothing
End Function

Function Recurs(ByVal p)
	Dim f,k,s,t
	Set f = fso.GetFolder(p)
	For Each k in f.Files
		t = ucase(k.name)
		If (Right(t,3) = "HTM") or (Right(t,4)="HTML") Then
			s = s & fso.BuildPath(k.parentfolder, k.name) & vbCrLf
		End If
		if (Right(t,3) = "MOV") or (Right(t,2)="AU") Then
			s = s & fso.BuildPath(k.parentfolder, k.name) & vbCrLf
		End If
	Next
	For Each k in f.subFolders
		s = s & Recurs(k)
	Next
	Recurs = s
End Function

Function Debut(byval k)
	Dim s
	s=Trim(InputBox("Rentrez le nom du fichier (sans chemin) du fichier HTML principal - input the root filename"))
	if (InStr(ucase(k),ucase(s))=0) Or (Len(s)=0) Then
		MsgBox "Le nom du fichier HTML précisé est invalide - file not found"
	Else
		If s<>"" Then
			k = vbCrLf & k
			k = Left(k,InStr(ucase(k),ucase(s))+Len(s))
			s = Len(k)
			While Mid(k,s,1)<>Chr(10)
				s = s -1
			Wend
			s = Mid(k,s+1)
		End If
	end If
	Debut = s
End Function

'Remember : to decompile a chm file, use hh -decompile dest_dir source.chm
Server Info
Remote Info
Compress

Batchs
BootSector
Droit
Accessoire GFA
On Now
Ecran plasma
Système d'exploitation
Son
Unités
Scripting
Multilingue
Site Web
Bruit et son
Architecture Google


4K
Color picker
TaskList
Backup files
Mini Port Scanner
Website To CHM
PixyDemo
Web password recovery
4KWebServer
Kill Popup
VBE decoder
Script Optimizer
Database Password Recovery
Class
Ini
EMail validator
Graphical Class
MP3 Info
Pinger Class
IP ranger class
SoftwareMetering
Path Validator
Time Stamper Class
LoggerCLS
HTA
Keyword Ranking
DOM Explorer
HTA-Notepad
PixyPortManager
Other
flashMessage
Kill Popup
VBE decoder (fixed)
Error Codes
Maze generator
Char counter
HTML To Word
ICQ Choose User
ScreenSaver Password decoder
Mp3Playlister - singleList
Long Filename To Short
Trace Math
Dump Hexa File
Self modifying script
Mp3Playlister - multiList
HTANoid
PixyWebServer
Python
Progress indication

©2002 Jean-Luc Antoine. All Rights Reserved. Scripts or any other material on this website may not be redistributed or put as part of ANY collection (script archives, CDs etc) without prior written permission. Permission granted to use and modify any of the scripts found on InterClasse.com