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.
[Solved] AutoHotkey help file navigation
[Solved] AutoHotkey help file navigation
Last edited by ejdewan on 17 Apr 2017, 17:27, edited 1 time in total.
Re: AutoHotkey help file navigation
This gets the control under the mouse:
You might be able to use ControlSend to send stuff directly to the correct control:
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.
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
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
Also maybe useful: A_CaretX and A_CaretY.
Re: AutoHotkey help file navigation
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).
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).
Re: AutoHotkey help file navigation
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
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
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
[Solved] AutoHotkey help file navigation
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.
Re: [Solved] AutoHotkey help file navigation
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
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
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA