chm file: get internal file contents (navigate to js file, don't download it)

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

chm file: get internal file contents (navigate to js file, don't download it)

26 May 2018, 23:49

- I've been looking for ways to get the contents of files inside a chm file, without decompiling the chm file.
- I was able to use an Internet Explorer object to navigate to certain internal files (e.g. an hhk file), but not an internal js file. If I try to navigate to an internal js file, it tries to download that file instead of navigate to it and display its plaintext contents. I was wondering if there was some way to get the contents of the js file.
- I'm looking to return to this:
HTML Help alternative via Internet Explorer - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=42129

Code: Select all

q:: ;chm file: get internal file contents (navigate to js file, don't download it)
;note: using vPath1/4 should work
;note: using vPath2/3/5/6 results in an attempt to download rather than display the js file
vDirChm := A_Desktop "\AutoHotkey_1.1.29.00\AutoHotkey" ;assumes the chm file was decompiled (e.g. via 7-Zip)
vPath1 := vDirChm "\Index.hhk"
vPath2 := vDirChm "\docs\static\source\data_index.js"
vPath3 := vDirChm "\docs\static\source\data_toc.js"

vPathChm := A_Desktop "\AutoHotkey_1.1.29.00\AutoHotkey.chm"
vPath4 := "its:" vPathChm "::/Index.hhk"
vPath5 := "its:" vPathChm "::/docs/static/source/data_index.js"
vPath6 := "its:" vPathChm "::/docs/static/source/data_toc.js"

oWB := ComObjCreate("InternetExplorer.Application")
oWB.Visible := True
oWB.Navigate(vPath1)
while oWB.busy || !(oWB.ReadyState = 4)
	Sleep, 10
Clipboard := oWB.document.documentElement.outerHTML
;Clipboard := oWB.document.documentElement.innerText
oWB := ""
MsgBox, % "done"
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: chm file: get internal file contents (navigate to js file, don't download it)

27 May 2018, 19:28

- Oh dear, it seems that if you navigate to this link in Internet Explorer:
its:C:\Program Files\AutoHotkey\AutoHotkey.chm::/docs/commands/SubStr.htm
For newer versions of the help file, it shows a loading icon that never completes. In older versions it loads correctly.
- So it looks like any attempt to navigate to links within chm files won't work.
- It looks like decompiling the chm to separate htm files will be necessary for my HTML Help replacement. You can extract (decompile) the contents of a chm file to a folder by using 7-Zip quite easily, but avoiding the extraction would have been preferable. You can also use hh.exe which comes with Windows.
- So, I have two chm file issues: retrieve the contents of an internal js file, and navigate to an internal htm file in Internet Explorer.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
GitHub: TLMcode
Contact:

Re: chm file: get internal file contents (navigate to js file, don't download it)

30 May 2018, 14:14

Not sure if this'l help you but iirc AHKStudio has an included help file lexer that you may be able to use.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
GitHub: TLMcode
Contact:

Re: chm file: get internal file contents (navigate to js file, don't download it)

30 May 2018, 15:49

....interesting I just found this help file COM object.. test to see if you have it try msgbox % IsObject( ComObjCreate( "Internet.HHCtrl.1" ) ) >:)

Code: Select all

CLSID: {52A2AAAE-085D-4187-97EA-8C30DB990436}
Description: HHCtrl Object
Product Name: HTML Help
File Name: hhctrl.ocx
going to dump the members later when I'm not on my cell lol
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: chm file: get internal file contents (navigate to js file, don't download it)

30 May 2018, 17:03

Yes, yes I do have it (Windows 7). Interesting, thanks.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], HiSoKa, montie, MrDoge, wetware05, XMCQCX and 72 guests