;MS EXCEL
Get text from status bar - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=9996
I wrote a function that gets the text from Excel 2007's status bar.
Please confirm if it works on other versions of Excel. Or use AccViewer to work out and share modified versions of the function that work on other versions of Excel.
Code: [Select all] [Expand] [Download]GeSHi © Codebox Plus
;e.g. ;WinGet, hWnd, ID, ahk_class XLMAIN ;MsgBox, % JEE_ExcelStatusBarGetText(hWnd) ;return ;e.g. status bar text: Ready/Edit/Enter ;tested on Excel 2007 ;requires Acc library JEE_ExcelStatusBarGetText(hWnd) { ControlGet, hCtl, Hwnd,, NetUIHWND1, % "ahk_id " hWnd oAcc := Acc_Get("Object", "4.1", 0, "ahk_id " hCtl) vText := oAcc.accValue(0) oAcc := "" return vText }
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
simple functions relating to highlighting, tested on Excel 2007. I generally do everything via macros, but the 3 functions on this page are the few exceptions.
;================================================== ;e.g. ;WinGet, hWnd, ID, ahk_class XLMAIN ;JEE_ExcelFillColor(hWnd) ;return ;tested on Excel 2007 ;requires Acc library ;click the Fill Color button JEE_ExcelFillColor(hWnd) { ControlGet, hCtl, Hwnd,, NetUIHWND2, % "ahk_id " hWnd oAcc := Acc_Get("Object", "4.14.1.1.2.11.1", 0, "ahk_id " hCtl) oAcc.accDoDefaultAction(0) oAcc := "" } ;================================================== ;e.g. ;WinGet, hWnd, ID, ahk_class XLMAIN ;JEE_ExcelFillColorSet(hWnd, "FF0000,FFFF00,") ;return ;tested on Excel 2007 ;choose the highlight colour from the Colors dialog or click Fill None ;JEE_ExcelRecentColorsAdd JEE_ExcelFillColorSet(hWnd, vList) { StrReplace(vList, ",", "", vCount), vCount += 1 Loop, Parse, vList, % "," { if (A_LoopField = "") { SendInput !hhn ;No Fill continue } SendInput !hhm ;Colors dialog Loop, 3 vCol%A_Index% := "0x" SubStr(A_LoopField, (A_Index*2)-1, 2) WinWaitActive, Colors ahk_class bosa_sdm_XL9 WinGet, hWnd, ID, Colors ahk_class bosa_sdm_XL9 Sleep 1000 SendInput ^{Tab} ControlSetText, RichEdit20W10, % vCol1+0, % "ahk_id " hWnd ControlSetText, RichEdit20W11, % vCol2+0, % "ahk_id " hWnd ControlSetText, RichEdit20W12, % vCol3+0, % "ahk_id " hWnd SendInput {Enter} WinWaitNotActive, % "ahk_id " hWnd if (A_Index = vCount) Sleep 1000 } } ;==================================================