Discussion:
[Notepad-plus-plus] [notepad-plus - Open Discussion] Searching inside CHM files
SourceForge.net
2009-08-26 16:19:08 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7586829
By: djn2

Hello folk!

Some time ago I posted a solution to open a CHM (Windows Compiled HTLP Help)
file at the page of a highlighted function (see “Launching PHP CHM Manual”
at https://sourceforge.net/forum/forum.php?thread_id=2082783&forum_id=331754
). This trick required the CHM file to have an internal structure that uses
the function keyword as part of the internal path. Works great with the PHP
manual, not so with other useful help files like the MySQL manual and such.
What was called for was a way to have the help file use its internal search
function to find the supplied term.

Well, I've found the way and I'm going to share...

The first thing you need is KeyHH.exe, which comes with the freeware KeyTools,
a set of utilities to work with the CHM format (http://www.keyworks.net/keytools.htm
). Download the installer, run it and copy KeyHH.exe from the install folder
(there might be another copy in C:\Windows too) to the folder where your CHM
help file is.

The following practical example uses the Smarty CHM manual located in C:\Program
Files\Manuals . Feel free to adapt paths to your exact location.

With Smarty.chm and KeyHH.exe in the same folder open a command window there
and type:

KeyHH -somerandomid -#klink "escape" Smarty.chm

Unless you've misplaced some of the files the Smarty manual will open at the
instructions for “escape”.
Now, this doesn't work when called from NPP's Run menu, as the resulting DOS
box opens in the NPP folder. You can't seemingly supply a full quoted path to
the manual as KeyHH chokes on the quotes around the target filename. What is
needed here is a batch file to change the working directory. So create a new
file named runsmarty.bat inside the same directory and edit it thus:

@ECHO OFF
cd "C:\Program Files\Manuals"
KeyHH -Smarty -#klink "%1" Smarty.chm
exit

Note: you may omit the @ECHO OFF stuff or comment it out putting "REM " in front
of it while debugging the thing. Test the batch file from the command window
with:

runsmarty escape

The manual should open at the same page as before. Once you have the batch file
working you can edit the NPP configuration in shortcuts.xml (either in NPP folder
or %APPDATA%) adding this command:

<Command name="Smarty Manual" Ctrl="yes" Alt="yes" Shift="no" Key="0">
&quot;C:\Program Files\Manuals\runsmarty.bat&quot;
&quot;$(CURRENT_WORD)&quot;</Command>

Save, restart NPP, type a Smarty command (say escape, include or config_load)
into a blank file and test: highlight the word, select “Smarty manual” from
the Run Menu and it should work.

You'll notice there is a DOS box that stays open until you close the CHM file.
If this doesn't bother you, you're done – you can safely skip the rest of
this post.

If you want the DOS box to get out of the way instead you have more to set up.
What is needed now is NirCmd, a free utility by Nir Sofer. Download the thing
from http://www.nirsoft.net/utils/nircmd.zip , extract nircmd.exe and put it
in the Manuals folder. This done, edit the <Command></Command> part in shortcuts.xml
to contain this:

&quot;C:\Program Files\Manuals\NirCmd.exe&quot; exec hide
&quot;C:\program Files\Manuals\runsmarty.bat&quot; $(CURRENT_WORD)

Well that's it. Now the DOS box won't even show and the manual will open at
the requested page (as long as there is such a page).

For the born tinkerers there is an alternate way to send the working directory
– you may like it more this way or not: drop the »cd "C:\Program Files\Manuals"«
from runsmarty.bat and edit the command to this:

&quot;C:\Program Files\Manuals\NirCmd.exe&quot; exec2 hide
&quot;C:\Program Files\Manuals&quot;
&quot;C:\program Files\Manuals\runsmarty.bat&quot; $(CURRENT_WORD)

This behaves exactly the same way, but the working directory is set via NirCmd
instead of the batch file (notice the exec2 thing and the added quoted path).
All examples above have been broken into multiple lines for readability only.
Up to now I've set up this stuff for Smarty, MySQL 5 and jQuery manuals –
all of them working fine.

Note: once you have a working command in the Run menu you can add it to the
right-click menu editing the contextMenu.xml file and adding stuff like:

<Item MenuEntryName="Run" MenuItemName="Smarty Manual"/>

This way you can select a function, right-click and look it up in the manual
without leaving your mouse. Beats some (expensive) IDE I've tried out lately
by a mile.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-08-27 01:25:30 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7588133
By: xjzhang1979

Does it play the same role with plugin "LanguageHelp"?

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-08-27 03:40:19 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7588294
By: djn2

There are a lot of similarities. The main differences are the ease of integration
into the context menu (couldn't make it work either with items in the Help menu
or in Plugins->LanguageHelp submenu) and the fact that LanguageHelp doesn't
seem to open the MySQL manual at the correct page (at least with refman-5.0-en.chm
revision 10739 - it just opens the start page)

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-08-27 09:16:18 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7588805
By: cchris

There was a very recent update of LanguageHelp. Does it fix this? If not, try
contacting the author.

CChris

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-08-27 13:17:18 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7589278
By: janschreiber

Adding the following to contextMenu.xml did the trick for me:

<Item id="0"/>
<Item PluginEntryName="LanguageHelp" pluginCommandItemName="Help"/>

I forgot how I found out about this one.


______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-08-27 14:39:00 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7589460
By: djn2

Thank you both for your suggestions. I've installed version 1.301 of LanguageHelp
(released yesterday, I see) with NPP 5.4.5 Unicode and created four entries
(MySQL, jQuery, ADOdb, Smarty), putting them one by one in the plugin's submenu.
As far as I can see selecting a word and clicking on a manual in the plugin's
submenu still opens that manual on the starting page instead of the selected
function's page (nothing changes if the entries are under the Help menu, BTW).
The plugin manages instead to open a manual on the correct page if I launch
it clicking on the "Menu" subitem. There are some hitches, anyway: the plugin
only activates the manual if the file has already been saved and saved with
an extension registered for that entry. In this case the opened manual is always
the first one with which that extension has been associated.
Example: say I have entries for MySQL and Smarty associated with the .php extension.
Editing a new unsaved file and selecting an arbitrary word ("INSERT"), nothing
happens when I click on Menu, while clicking on the MySQL entry opens the MySQL
manual at the start page. When I save said file as test.php and select the same
term the behavior of the MySQL entry doesn't change - it still opens at the
start page - while clicking on the Menu entry opens the MySQL manual at the
INSERT page. Fine, but Help automatically selects MySQL as the first manual
associated with .php and to look up a term from another manual (say, "config_load"
from the Smarty one) I'm back to square one.
Further I followed Jan's suggestion for the context menu (note: it is "Language
Menu" with a space in between) and it worked only for the Menu subitem, the
single entries won't show in the context menu.
All things considered and after a couple of days of right-clicking I still like
my Command + batch thingie a lot more. As it is far from uncommon for me to
have PHP functions, SQL statements and Smarty and ADOdb methods in the same
file it's just way faster overall. Even if the configuration is somewhat more
"hands-on", once you've done it for the first manual it's just copy-pasting
some file around and editing a couple of textfiles with the correct path...
I thought of contacting the author of LanguageHelp, but it seems that he has
nor a contact form neither an email address on his website.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-08-27 16:20:06 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7589663
By: cchris

Email fstellari )at( users * sourceforge ~ net (with seemingly obvious normalistion
to make it correct! )

CChris

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-09-01 19:41:59 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7602169
By: fstellari

Hi,

The entries created either in the Help menu or in the Language Help menu are
designed to open the help fil on the main page to replicate the behavior of
other editors.
However, it that could solve your problem, I could add an option to enable/disable
the search for current word instead of the main page.

CTRL+F1 is (i.e. the Help menu) is the way to search for words.
Obviously I cannot foresee what help you want to open without an extension that
helps me.

So may be adding the initial new feature would allow you to select it by
yourself.

Franco

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-09-03 02:28:31 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7605668
By: fstellari

I have uploaded a new version of the plugin with several new features:
https://sourceforge.net/forum/message.php?msg_id=7605664

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-09-03 08:01:27 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7606382
By: djn2

Hello Franco, and thank you for the effort you're putting into this. I've just
tried out v. 1.31 and I fear something has gone wrong with this version.
I've used a separate setup of N++ 5.4.5 Unicode with no other plugin (on WinXP
Pro SP3) and now the single manual entries don't even launch the manual...
Besides this, either of the 'show in context menu' options does not add the
manual entries to the right-click menu (the default one, with no items added
by me).
I've tried playing with the various options there to no effect.
I suppose some bug must have slipped by.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-09-03 13:35:53 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7607013
By: fstellari

Sorry about that... after all testing I swapped two lines for code cleanup and
ended up disabling main message hook. Please download the new version 1.311.
Franco

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-09-03 15:02:46 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7607182
By: djn2

Well... works great! My hat is off. Really neat.

May I make a couple of suggestions? Move Up and Move Down buttons would be handy
for the manuals list, otherwise adding a new manual and making it default would
imply deleting all old entries and creating them again.
An option to have the manuals at the top of the context menu might make sense
too.

Last question: is the Test button supposed to check for the existence of the
linked file? I see it giving the same info box whether the path is correct or
not.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-09-03 17:08:15 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7607445
By: fstellari

I think you want to re-order the list of help files... at the moment I'm not
planning to do it since it's a lot of code with little use for me. I think most
people have a short list. However, it it's useful for you you can edit the INI
file and reorder the entries there... the same order will magically show up
in the menu.

Regarding the top of the context menu... I knew it was coming... it will be
done when I have a chance. See the newly released RunMe 1v30 to see how
it works.

Yeah "Test" is not a test... it's more a Expand for debug of your path statement.
I guess it should be reasonably easy to make it a real test... i.e. emulate
pressing the help button.

Franco

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-09-04 16:05:31 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7609479
By: djn2

Of course you're right. Editing the INI file is straight obvious once one thinks
of it, but somehow I'd never get it by myself. Works spotlessly.

I'll keep waiting for the 'Top of context' option - I've seen the way you've
done it in RunMe and it's very intuitive indeed.

If I may make one more suggestion: is there any particular reason for the menu
positions (context, plugin submenu, help) to be mutually exclusive? I'm fine
with right-clicking, but somebody might want it in more that one place.

Thank you again for your effort (and patience).

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753
SourceForge.net
2009-09-05 15:09:29 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7610971
By: fstellari

Please check the new version and comment under this thread:
https://sourceforge.net/forum/message.php?msg_id=7610967

There was no particular reason at the time... one place seemed enough.
Now it would take more work to change it.
You are the first to ask, probably most people just press Ctrl+F1

Regards,

Franco

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331753

Continue reading on narkive:
Loading...