Page 1 of 1

CtrlTab command analogous to AltTab

Posted: 11 Nov 2023, 18:32
by vsl
The AltTab command: https://www.autohotkey.com/docs/v2/Hotkeys.htm#alttab
It would be useful to have a similar CtrlTab command to be able to switch tabs in a browser and other programs by a custom hotkey.

Re: CtrlTab command analogous to AltTab

Posted: 13 Nov 2023, 23:34
by Saiapatsu
The existence of the AltTab function seems unusual to me in the first place.
I guess that AHK needs to do something special to manipulate the Alt-Tab menu properly and Send "!{Tab}" doesn't cut it.

But because there's no OS-level Ctrl-Tab thing going on, you can simply remap your key to Ctrl-Tab without issues, no CtrlTab function needed.

Code: Select all

h::+^Tab
l::^Tab
ExampleFunction()
{
	MouseGetPos &x, &y
	if y < 30
		Send "^{Tab}"
}

Re: CtrlTab command analogous to AltTab

Posted: 14 Nov 2023, 05:37
by vsl
@Saiapatsu Send "^{Tab}" will not trigger the Ctrl-Tab menu.

Re: CtrlTab command analogous to AltTab

Posted: 16 Nov 2023, 20:44
by lexikos
What do you suppose that CtrlTab will do, exactly? All it can do is send keystrokes. Whatever key sequence you use to activate the menu normally, you just need to replicate that with Send. Ctrl-tab menus are not a standard/system construct, and as such may behave differently in different applications, or even different configurations of the same application.

Re: CtrlTab command analogous to AltTab

Posted: 25 Dec 2023, 06:26
by vsl
@lexikos I want to reassign Ctrl+Tab functionality (like cycling through the tab list in a browser) to another key combination. Send "^{Tab}" will just switch between the latest tabs and release the menu.

Re: CtrlTab command analogous to AltTab

Posted: 18 Jan 2024, 22:28
by lexikos
@vsl, I guess you miss my point. How would you activate such a menu without the script? You would not press and release Ctrl+Tab, because that would "switch between the latest tabs and release the menu". I presume you would press and hold Ctrl and press and release Tab. You need to figure out the individual events - such as press Ctrl = {Ctrl down}, release Ctrl = {Ctrl up}, press and release Tab = {Tab} - and send them at appropriate times. What exactly "appropriate times" means may depend on the application, because Ctrl-Tab menus are not a standard/system construct.

There is nothing that a built-in CtrlTab construct could do that can't already be done with the existing constructs. It would only be less flexible.