navigate between buttons in GUI that is not activated

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Spitzi
Posts: 313
Joined: 24 Feb 2022, 03:45

navigate between buttons in GUI that is not activated

Post by Spitzi » 15 Aug 2022, 03:14

Hello.

I have a GUI with multiple buttons for inserting text in a word document. This GUI is always on top, but not activated ,as I want keyboard input to go to the word document. Now I wand to use the up/down arrow keys to navigate from one button to the next, without leaving word. "Enter" should trigger a click to the selected button, again without activating the GUI window. I tried the following code, but it does not work

Code: Select all

;#IfWinExist, myGUI
Down:: 
ToolTip, Down
ControlSend, ahk_parent, {Tab} ,myGUI
return

Up:: 
ToolTip, Up
ControlSend, ahk_parent, {Shift down}{Tab}{Shift up} ,myGUI
return

Enter::
ToolTip, Enter
ControlSend, ahk_parent, {Enter} ,myGUI
return
;#IfWinExist

what am I doing wrong? Thanks for any help. This forum is great. Simon

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: navigate between buttons in GUI that is not activated

Post by BoBo » 15 Aug 2022, 03:46

I'd guess that it would become more reliable if you target the respective control(s) instead of it's "surrounding" ahk_parent?
What is the GUI responding if you’re using ControlGetFocus instead?

Spitzi
Posts: 313
Joined: 24 Feb 2022, 03:45

Re: navigate between buttons in GUI that is not activated

Post by Spitzi » 15 Aug 2022, 15:12

Hi Bobo

Good idea. The function returns blank, probably because the window is not activated and no control has the focus...

Post Reply

Return to “Ask for Help (v1)”