Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

start chm file with specific page


  • Please log in to reply
15 replies to this topic
toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Hi,

How could I start the AHK manual with a specific page or even a specific pargraph on that page? Curently I have
AHKManualFile := RegExReplace(A_AHKPath . ".chm", ".exe." , ".")
Run %AHKManualFile%
But that only starts the manual with the first page.
How do I have to extent the command line to open e.g. the "Gui control type" page with pargraph "slider" visible?
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
it must be something like

mk:@MSITStore:C:\Programme\AutoHotkey\AutoHotkey.chm::/docs/commands/GuiControls.htm#Slider

but I do not know what exactly.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

rogerg (as guest)
  • Guests
  • Last active:
  • Joined: --
I have two suggestions, assuming I understand what you are asking.

First, open the manual to the page you want to start at, then right click
and choose "create short-cut" from the context menu. Then all you have
to do is execute the short-cut. Or you can probably 'open' or "run' the short-cut's
target address (I seem to recall doing something like that before, but it escapes me right now).

Second, you could start the manual from a script, that immediately executes a
"manual search" using key words that the search would take you to the desired page.
See http://www.autohotke...nsitiveHelp.htm for an example
script using this method.

rogerg

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
AHKManualFile := RegExReplace(A_AHKPath . ".chm", ".exe." , ".")
Run, hh.exe "mk:@MSITStore:%AHKManualFile%::/docs/commands/GuiControls.htm#Slider"

Works fine & tested in Windows 2000

:)





my 2000th post
kWo4Lk1.png

SanskritFritz
  • Members
  • 280 posts
  • Last active: Jan 09 2013 02:15 PM
  • Joined: 17 Feb 2005
There is an example for this function in majkinetor's ISense script:
<!-- m -->http://www.autohotke...pic.php?t=12985<!-- m -->
(IE.ahk)
Is there another word for synonym?

JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004
...ok so Goyyah answered already...pfft!...here's mine...(with a better regex)...

section=docs/commands/Gui.htm#Add
A_AHKHelpPath:=RegExReplace(A_AHKPath, "\.exe$", ".chm")
Run, hh %A_AHKHelpPath%::/%section%

Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
OK, it wasn't so obvious, but with the help of the SciTE code which can lookup a help item on the current word, I figured out a way to do it:
hh_Function = HHCtrl.ocx\HtmlHelpA

HH_DISPLAY_TOPIC = 0x00
HH_KEYWORD_LOOKUP = 0x0D
HH_HELP_CONTEXT = 0x0F
HH_CLOSE_ALL = 0x12
HH_INITIALIZE = 0x1C
HH_UNINITIALIZE = 0x1D

cookie = 0000

manualFile := RegExReplace(A_AhkPath, "\.exe$", ".chm")

;~ DllCall(hh_Function, "UInt", 0, "UInt", 0, "UInt", HH_INITIALIZE, "UInt", &cookie)

HtmlHelp(manualFile, "start")

HtmlHelp(manualFile, "topic", "", "/docs/commands/Random.htm")
If (ErrorLevel != 0)
	MsgBox Cannot open the help! (%ErrorLevel%)

Pause

HtmlHelp(manualFile, "topic", "Picture", "/docs/commands/GuiControls.htm")
If (ErrorLevel != 0)
	MsgBox Cannot open the help! (%ErrorLevel%)

Pause

HtmlHelp(manualFile, "lookup", "#IfWinActive")
If (ErrorLevel != 0)
	MsgBox Cannot open the help! (%ErrorLevel%)

Pause

Goto Escape

Escape::
	HtmlHelp(manualFile, "stop")
;~ 	DllCall(hh_Function, "UInt", 0, "UInt", 0, "UInt", HH_UNINITIALIZE, "UInt", cookie)
ExitApp

+F1::Pause

HtmlHelp(_helpFile, _action, _keyword="", _page="")
{
	local hhSize, hh_aklink

	If (_action = "start")
	{
		DllCall(hh_Function
				, "UInt", 0	; hwndCaller
				, "Str", _helpFile
				, "UInt", HH_DISPLAY_TOPIC
				, "UInt", 0)
	}
	Else If (_action = "stop")
	{
		DllCall(hh_Function, "UInt", 0, "UInt", 0, "UInt", HH_CLOSE_ALL, "UInt", 0)
		Sleep 10
		DllCall(hh_Function
				, "UInt", 0	; hwndCaller
				, "Str", _helpFile
				, "UInt", HH_DISPLAY_TOPIC
				, "UInt", 0)
	}
	Else If (_action = "topic")
	{
		If (_keyword != "")
			_page := _page . "#" . _keyword . ">AHK"
		DllCall(hh_Function
				, "UInt", 0	; hwndCaller
				, "Str", _helpFile . "::" . _page
				, "UInt", HH_DISPLAY_TOPIC
				, "UInt", 0)
	}
	Else If (_action = "lookup")
	{
/*
http://msdn.microsoft.com/library/en-us/htmlhelp/html/vsconHowcallingthehtmlhelpapi.asp
http://msdn.microsoft.com/library/en-us/htmlhelp/html/vsconovhtmlhelpapioverview.asp
http://www.helpware.net/FAR/far_faq.htm

typedef struct tagHH_AKLINK
{
     int      cbStruct;     // 0
     BOOL     fReserved;    // 4
     LPCTSTR  pszKeywords;  // 8
     LPCTSTR  pszUrl;       // 12
     LPCTSTR  pszMsgText;   // 16
     LPCTSTR  pszMsgTitle;  // 20
     LPCTSTR  pszWindow;    // 24
     BOOL     fIndexOnFail; // 28
} HH_AKLINK;
*/
		hhSize = 32
		VarSetCapacity(hh_aklink, hhSize, 0)
		SetInteger(hh_aklink, hhSize)
		SetInteger(hh_aklink, &_keyword, 8)
		SetInteger(hh_aklink, 1, 28)

		DllCall(hh_Function
				, "UInt", 0	; hwndCaller
				, "Str", _helpFile
				, "UInt", HH_KEYWORD_LOOKUP
				, "UInt", &hh_aklink)
	}

	Return ErrorLevel
}


SetInteger(ByRef @dest, _integer, _offset = 0, _size = 4)
{
	Loop %_size%  ; Copy each byte in the integer into the structure as raw binary data.
	{
		DllCall("RtlFillMemory"
				, "UInt", [email protected] + _offset + A_Index-1
				, "UInt", 1
				, "UChar", (_integer >> 8*(A_Index-1)) & 0xFF)
	}
}
Note that the help window is closed with its parent application.
I choose, like SciTE, to lookup the keyword, it is more likely to work than using a path.

[EDIT 1] Of course, I overlooked the simple solution... Yet, this method is interesting because it searches the index, instead of relying on building a path.
[EDIT 2] Updated the source to allow the use of HH_DISPLAY_TOPIC. Theoretically, it should be called before HH_KEYWORD_LOOKUP to create the window.
I also do the proper (per MSDN) init and uninit. Not sure if it works, the script is crashing now... Seems it became unstable (memory?).
[EDIT 3] I added start and stop actions... More encapsulation. Still crashes, hopefully only because of previous bad operations.
Added also a link to an HtmlHelp Faq: <!-- m -->http://www.helpware....FAR/far_faq.htm<!-- m -->
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Thanks a lot.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
@Philho: How would your method open a pargraph on that page?
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
I fear it cannot... I tried with "Picture", but it stays on home page.
Or WinWait AutoHotkey Help, then Send {Enter}... (just tested, it works... but must not do that when the search is successful! How to know?)
Or dig MSDN to see the remainder of the HtmlHelp, it has lot of possibilities.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Thanks, I think I stay with the hh.exe approach.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

majkinetor !
  • Guests
  • Last active:
  • Joined: --
This isnot a problem. You just have to know exact structure of chm file.
I recomend TC chm plugin to enter it like a folder and see its structure.

What I more want to know is how to start chm with the keywrod entered in the index like all editors do to open specific page when you request help for any language. This allows you not to know the structure but to depend on index witch is generaly batter and more universal way.

For instance, Editplus open right page of ahk chm when I press F1 on it in editor. When it doesn't exit it is typed in the index edit and left like that. If only one item is there with that keyword it will be open automaticaly.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Same for PSPad.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
That's exactly what I supplied, did you tried it?
At least, that's how it is implemented in SciTE.

You just have to know exact structure of chm file.
I recomend TC chm plugin to enter it like a folder and see its structure.

7-Zip also can open a CHM file like any other archive file.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005

That's exactly what I supplied, did you tried it?
At least, that's how it is implemented in SciTE.

I tried it when you posted the code first time.
It is not the way it is implemented in PSPad. You way opens the page but doesn't adjust the index. E.g. When your code opens the WinWait page the index is at the first topmost position.
With PSPad the WinWait page is shown but the index is also set to WinWait.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.