1
0
mirror of https://github.com/ret-Phoenix/SmartConfigurator.git synced 2026-06-13 22:34:24 +02:00
Files
SmartConfigurator/core/WorkWithWindows.ahk
2017-08-22 17:25:29 +03:00

42 lines
842 B
AutoHotkey

#IfWinActive ahk_class V8TopLevelFrame
getWindowType() {
ControlGetFocus, WinType
If (WinType = "V8Window4") {
Return "TextEditor"
}
If (WinType = "V8Window2") {
Return "TextEditor"
}
If (WinType = "V8Window3") {
Return "TextEditor"
}
return "unknown"
}
ActivateWindowByTitle(wndTitle) {
detect_hidden = 1
WinGet controls, ControlListHwnd
static WINDOW_TEXT_SIZE := 32767 ; Defined in AutoHotkey source.
VarSetCapacity(buf, WINDOW_TEXT_SIZE * (A_IsUnicode ? 2 : 1))
text := ""
Loop Parse, controls, `n
{
;if !detect_hidden && !DllCall("IsWindowVisible", "ptr", A_LoopField)
; continue
if !DllCall("GetWindowText", "ptr", A_LoopField, "str", buf, "int", WINDOW_TEXT_SIZE)
continue
if (buf = wndTitle) {
WinActivate, ahk_id %A_LoopField%
Break
}
}
}