 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
badmojo
Joined: 11 Nov 2005 Posts: 150
|
Posted: Thu Nov 22, 2007 5:04 am Post subject: Switching tabs programmatically? |
|
|
i would like the F2 key to switch tabs in a program. also if the last tab is active, it should revert to the 1st tab or move in reverse. how is this possible? i provide the code below..
| Code: | #IfWinActive ahk_class #32770
F2::
SendMessage, 0x1304,,, SysTabControl321, ahk_class #32770 ; get total tabs
TabCount = %ErrorLevel%
ControlGet, WhichTab, Tab, , SysTabControl321 ; get current tab
If WhichTab = TabCount ; if current tab equals total tab
Control, TabLeft, , SysTabControl321 ; move left
Else
Control, TabRight, , SysTabControl321 ; move right
;TrayTip, %appname%, TabCount = %TabCount%`nWhichTab = %WhichTab%
#IfWinActive |
|
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1259 Location: Denmark
|
Posted: Thu Nov 22, 2007 8:23 am Post subject: |
|
|
I tried with the SendMessage example from the help file:
| Code: |
#IfWinActive,AutoHotkey Help
F2::
SendMessage, 0x1304,,, SysTabControl321, A ; get total tabs
TabCount = %ErrorLevel%
ControlGet, WhichTab, Tab, , SysTabControl321, A ; get current tab
If WhichTab = %TabCount% ; if current tab equals total tab
SendMessage, 0x1330, 0,, SysTabControl321, A
Else
SendMessage, 0x1330, %WhichTab%,, SysTabControl321, A
TrayTip, %appname%, TabCount = %TabCount%`nWhichTab = %WhichTab%
return
#IfWinActive |
I tested with the help file for AHK, changes in red. _________________ there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face
- Kashmir |
|
| Back to top |
|
 |
badmojo
Joined: 11 Nov 2005 Posts: 150
|
Posted: Fri Nov 23, 2007 3:52 am Post subject: |
|
|
thanks tonne, it works! but being a dummy, can i know why it works?  |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|