Lexikos
Joined: 17 Oct 2006 Posts: 2737 Location: Australia, Qld
|
Posted: Fri Mar 21, 2008 10:43 pm Post subject: |
|
|
You want the hWnd, which indicates which window belongs to the button. The buttons are listed in the same order they appear on the task bar. Here's a demonstration using grep:
| Code: | ; Get all taskbar button info.
icons := TaskButtons()
; Grab a list of hwnds.
grep(icons, "(?<=\| hWnd: )(?:0x[0-9a-f]+|\d+)(?= \|)", hwnds)
; Split it into a quasi-array.
StringSplit, hwnd, hwnds,
; Activate the third button:
WinActivate, ahk_id %hwnd3% | I account for hexadecimal format in the regular expression, though TaskButtons() doesn't work with it as is. The first line of TaskButtons() would need to be replaced with something like:
| Code: | fi := A_FormatInteger
SetFormat, Integer, D
idxTB := GetTaskSwBar()
SetFormat, Integer, %fi% |
|
|