SourceForge.net
2009-08-26 16:19:08 UTC
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">
"C:\Program Files\Manuals\runsmarty.bat"
"$(CURRENT_WORD)"</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:
"C:\Program Files\Manuals\NirCmd.exe" exec hide
"C:\program Files\Manuals\runsmarty.bat" $(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:
"C:\Program Files\Manuals\NirCmd.exe" exec2 hide
"C:\Program Files\Manuals"
"C:\program Files\Manuals\runsmarty.bat" $(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
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">
"C:\Program Files\Manuals\runsmarty.bat"
"$(CURRENT_WORD)"</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:
"C:\Program Files\Manuals\NirCmd.exe" exec hide
"C:\program Files\Manuals\runsmarty.bat" $(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:
"C:\Program Files\Manuals\NirCmd.exe" exec2 hide
"C:\Program Files\Manuals"
"C:\program Files\Manuals\runsmarty.bat" $(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