[Solved] AutoHotkey help file navigation

Get help with using AutoHotkey and its commands and hotkeys
ejdewan
Posts: 19
Joined: 12 Feb 2017, 16:42

[Solved] AutoHotkey help file navigation

13 Apr 2017, 15:53

Short version: Is there a way to detect which side of the AutoHotkey help file the pointer is in, and to switch it back and forth? That is, the table of contents on the left, or the text on the right. See Long version below for my reason for wanting this.

Long version: I would like to program the two distinct sets of arrow keys to perform different functions while in the AutoHotkey help file. That is, the help file contains two windows, the one on the left being a table of contents, and the one on the right being the actual text of the document. I have programmed the numpad up and down arrow keys to do a normal up and down arrow followed by an {enter}, which works when I click in the table of contents window (in the document window, the {enter} has no effect). I would like also to use the normal up and down arrow keys as if the pointer were IN the text window. So, what I need is a way to detect which window the pointer is in, and then act accordingly, so I don't have to be constantly clicking the mouse to be changing windows.
Last edited by ejdewan on 17 Apr 2017, 17:27, edited 1 time in total.
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: AutoHotkey help file navigation

13 Apr 2017, 16:13

This gets the control under the mouse:

Code: Select all

#IfWinActive, AutoHotkey Help
F7::
    MouseGetPos, VarX, VarY, VarWin, VarControl
    ;~ MsgBox, % "The control under the mouse is " VarControl "."
    if (VarControl = "Internet Explorer_Server1")
        MsgBox, Document is focused.
return
#If
You might be able to use ControlSend to send stuff directly to the correct control:

Code: Select all

#IfWinActive, AutoHotkey Help
F7::
    ; "SysTreeView321" is the ClassNN of the "Contents" control (as determined by WindowSpy).
    ; The table of centents control needs to be visible. ie: you can't have the "Index" control active.
    ControlSend, SysTreeView321, {Down}{Enter}, AutoHotkey Help
return
#If
You might also try looking in the help file for the other "control"-type commands. ex: ControlGetFocus - Retrieves which control of the target window has input focus, if any.
Also maybe useful: A_CaretX and A_CaretY.
lexikos
Posts: 6668
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey help file navigation

13 Apr 2017, 23:41

I would guess ejdewan means the caret, not the mouse pointer; i.e. which control has the keyboard focus. kon's example uses the wrong terminology: the mouse pointer being over the Internet Explorer control does not mean the document is focused. If you want to send keys to the window, only the keyboard focus matters, not the mouse position.

Use ControlGetFocus or ControlFocus to get or set the keyboard focus. You can use Window Spy to identify the controls (or you can just check for "Internet Explorer_Server1" vs everything else).
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: AutoHotkey help file navigation

14 Apr 2017, 16:05

In HTML Help (AutoHotkey Help), you can use PgUp/PgDn, and Ctrl+A/Ctrl+C/Ctrl+F on the Internet Explorer_Server control, but not much else, for example you can't do caret browsing, right?

Anyhow, I thought I'd have a go at some 'pseudo-caret browsing', by emulating the mouse with the keyboard.

Note: it's possible to open AutoHotkey Help pages with Internet Explorer.
E.g. use either of these as the url:
mk:@MSITStore:C:\Program Files\AutoHotkey\AutoHotkey.chm::/docs/AutoHotkey.htm
its:C:\Program Files\AutoHotkey\AutoHotkey.chm::/docs/AutoHotkey.htm

Code: Select all

#IfWinActive, AutoHotkey Help
;'caret browsing' for HTML Help (AutoHotkey Help)
;ctrl+shift: alternative for the Win key
;LWin: left mouse button pressed/not pressed
;arrow keys: navigate

^Shift::
WinActivate, ahk_class Shell_TrayWnd
ControlClick, , Start ahk_class Button
return

*LWin::
SendInput {LButton down}
return
*LWin up::
SendInput {LButton up}
return

*Left::
*Right::
*Up::
*Down::
CoordMode, Mouse, Screen
MouseGetPos, vPosX, vPosY
vNum := 5
GetKeyState("Left", "p") ? (vPosX -= vNum) : ""
GetKeyState("Right", "p") ? (vPosX += vNum) : ""
GetKeyState("Up", "p") ? (vPosY -= vNum) : ""
GetKeyState("Down", "p") ? (vPosY += vNum) : ""
MouseMove, % vPosX, % vPosY
return
#IfWinActive
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
ejdewan
Posts: 19
Joined: 12 Feb 2017, 16:42

[Solved] AutoHotkey help file navigation

17 Apr 2017, 12:43

My apologies - I somehow got myself unsubscribed to my own post, so I haven't been here for a few days. Thanks to the members who responded. I will study the suggestions, and consider it solved for the time being.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: [Solved] AutoHotkey help file navigation

04 Sep 2017, 02:38

You may also find this interesting, to toggle caret browsing on/off in HTML Help:
AutoHotkey help file, caret browsing - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 10#p165910
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: au6, BushMange, CEA6597, howardb1, VACO BenQ, w0z and 191 guests