forked from AutoHotkey/AutoHotkeyDocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_chm.ahk
36 lines (30 loc) · 1.05 KB
/
compile_chm.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
if (A_PtrSize = 8) {
try
RunWait "%A_AhkPath%\..\AutoHotkeyU32.exe" "%A_ScriptFullPath%"
catch
MsgBox 16,, This script must be run with AutoHotkey 32-bit, due to use of the ScriptControl COM component.
ExitApp
}
; Change this path if the loop below doesn't find your hhc.exe,
; or leave it as-is if hhc.exe is somewhere in %PATH%.
hhc := "hhc.exe"
; Try to find hhc.exe, since it's not in %PATH% by default.
for i, env_var in ["ProgramFiles", "ProgramFiles(x86)", "ProgramW6432"]
{
EnvGet Programs, %env_var%
if (Programs && FileExist(checking := Programs "\HTML Help Workshop\hhc.exe"))
{
hhc := checking
break
}
}
SetWorkingDir %A_ScriptDir%\docs\static
; Rebuild Index.hhk and Table of Contents.hhc.
RunWait "%A_AhkPath%" source\CreateFiles4Help.ahk
FileMove content.js, content.temp.js, 1
FileMove content.chm.js, content.js
; Compile AutoHotkey.chm.
RunWait %hhc% "%A_ScriptDir%\Project.hhp"
; Put it back so that local viewing works.
FileMove content.js, content.chm.js
FileMove content.temp.js, content.js