The MASM Forum

Projects => MasmBasic & the RichMasm IDE => Topic started by: jj2007 on April 27, 2021, 06:56:22 PM

Title: Free search in a CHM file
Post by: jj2007 on April 27, 2021, 06:56:22 PM
For a friend in the FreeBasic forum: (https://www.freebasic.net/forum/viewtopic.php?f=2&t=29349)

0. Be prepared to see virus warnings: AV software hates assembly code (http://masm32.com/board/index.php?board=23.0). Ignore the warnings if you want to use this software, but here is the legal disclaimer: using my stuff is at your own risk.
1. Create a folder ChmSearch
2. Open the chm file (e.g. FB-manual-1.07.2.chm) in 7-zip
3. Extract all html files to the ChmSearch folder
4. From the attachment, extract the two executables to this folder
5. Run Extract.exe

From now on, dragging the *.jjn file over JNotes.exe allows a pretty fast search. Here is a screenshot:

(https://www.jj2007.eu/pics/FbHelpJJNv2.png)

The Manual for JNotes.exe:
- two search strings are allowed
- if the first one is all lowercase, search is case-insensitive
- right-click for favourites (confirm saving of settings when exiting)

P.S.: The source:

include \masm32\MasmBasic\MasmBasic.inc         ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
  Dim o$()
  GetFiles *.ht*                ; htm & html
  For_ ct=0 To eax-1
        mov ecx, Files$(ct)
        Let esi=FileRead$(ecx)
        Let edi=Extract$(esi, "<title>", "</title>")
        .if byte ptr [edi]=="?"
                Let edi=Left$(ecx, Instr_(ecx, ".html", 1)-1)  ; no title found: use filename
        .endif
        Let o$(ct)="@="+edi+CrLf$+NoTag$(esi)
  Next
  mov ecx, CurDir$(0)
  Let edi=Mid$(ecx, Rinstr(ecx, "\")+1)+".jjn"
  Store edi, o$()
  Launch Cat$("JNotes.exe "+edi)
EndOfCode