I've got some basic GUI questions for which I can't seem to find answers in the GUI docs.
The GUI script was created by username: boiler and when run, shows a list of filenames for currently-open Excel (2010) Windows.* Clicking one of the filenames activates the corresponding window.
Here is the script with my changes shown in the indented lines:
Code: Select all
SetTitleMatchMode, 2
ExcelList := {}
WinGet, WinList, List, Microsoft Excel - ahk_exe EXCEL.EXE
loop, % WinList
{
WinGetTitle, Title, % "ahk_id" WinList%A_Index%
ExcelList[StrReplace(Title, "Microsoft Excel - ")] := WinList%A_Index%
}
Gui, +ToolWindow +AlwaysOnTop
Gui, Font, s14, Tahoma
for Title, ID in ExcelList
;Gui, Add, Button, xm w200 v%ID% gExcelBtn, % Title
Gui, Add, Button, xm w600 v%ID% gExcelBtn, % Title
Gui, Add, Button, xm+50 w100, Refresh
;Gui, Show,, Excel Windows
Gui, Show, w800, h1000,, Excel Windows
return
ButtonRefresh:
reload
ExcelBtn:
WinActivate, % "ahk_id" A_GuiControl
return
GuiClose:
ExitApp
^Esc::ExitApp
Questions
• How can I get the filenames to display with left justification rather than centered?
• Why does the name of the GUI (upper-left corner) display "w800" instead of "Excel Windows" as it did originally?
• How can I get the GUI and individual fields to open with widths just large enough to contain the content (without wrapping) rather than with a fixed width?
• How can I get the GUI to close automatically once I click one of the filenames?
Bonus Question
• How can I modify the list to show the filenames in the order they were opened rather than alphabetically?
Thanks
*https://www.autohotkey.com/boards/viewtopic.php?f=76&t=73680&start=20