- For the q hotkey subroutine that needs Excel_Get.Call to nonexistent function.
- For the q hotkey subroutine that needs Acc.
- Copy and paste code into a script. Or see:
#Include
https://autohotkey.com/docs/commands/_Include.htm
- To fix this. Add: 'local hwnd' to the top of the Excel_Get function, inside it.This local variable has the same name as a global variable.
- Or comment out #Warn in your script.
- See:
#Warn
https://autohotkey.com/docs/commands/_Warn.htm
- Windows have classes e.g. Notepad, WordPadClass.I don't understand: "classname and instance number" or what is meant by "the controls text" or "text that the window must contain" or "list the controls that a window contains".
- Controls have classes e.g. Edit, msctls_statusbar32.
- AutoHotkey refers to controls via 'ClassNNs' e.g. 'Edit1' is the 1st Edit control in the window, 'Edit2', the 2nd. That number is the instance number.
- With IfWinActive for example, the WinText parameter:
IfWinActive / IfWinNotActive / WinActive
https://autohotkey.com/docs/commands/WinActive.htm
'this parameter must be a substring from a single text element of the target window'
Using the WinText parameter means that IfWinActive checks if the current window contains at least one control whose text contains whatever is in the WinText parameter.
- To list controls in a window, and their text:
Code: Select all
w:: ;list controls (ClassNNs) and their text
WinGet, hWnd, ID, A
WinGet, vCtlList, ControlList, % "ahk_id " hWnd
vLim := 100, vOutput := ""
Loop, Parse, vCtlList, `n
{
vCtlClassNN := A_LoopField
ControlGetText, vText, % vCtlClassNN, % "ahk_id " hWnd
if (StrLen(vText) > vLim)
vText := SubStr(vText, 1, vLim) "..."
vText := StrReplace(vText, "`r", " ")
vText := StrReplace(vText, "`n", " ")
vOutput .= vCtlClassNN "`t" vText "`r`n"
}
;Clipboard := vOutput
MsgBox, % vOutput
return