The window having WinClassNN is not necessarily active.
A sample script illustrating it would be helpful.
Code: Select all
^+!F12::
{
MouseGetPos,,,, WinClassNN
; Detect if WinClassNN is vertically scrollable
return
}
Code: Select all
^+!F12::
{
MouseGetPos,,,, WinClassNN
; Detect if WinClassNN is vertically scrollable
return
}
Code: Select all
e:: ;check for WS_VSCROLL window style
WinGet, hWnd, ID, A
ControlGetFocus, vCtlClassNN, % "ahk_id " hWnd
ControlGet, vCtlStyle, Style,, % vCtlClassNN, % "ahk_id " hWnd
MsgBox, % vCtlClassNN "`r`n" "has WS_VSCROLL? " !!(vCtlStyle & 0x200000) ;WS_VSCROLL := 0x200000
return
q:: ;Notepad - get vertical scrollbar state
ControlGet, hCtl, Hwnd,, Edit1, ahk_class Notepad
oAcc := Acc_Get("Object", "5", 0, "ahk_id " hCtl)
vChildId := 0
vAccStateNum := oAcc.accState(vChildId)
vAccStateNum := Format("0x{:X}", vAccStateNum)
vAccStateText := Acc_GetStateText(oAcc.accState(vChildId))
MsgBox, % vAccStateNum " " vAccStateText
oAcc := ""
return
;w:: ;Internet Explorer - get scroll height
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
vScrollHeight1 := oWB.document.body.scrollHeight
vScrollHeight2 := oWB.document.documentElement.scrollHeight
;vScrollTop := oWB.document.documentElement.scrollTop
MsgBox, % vScrollHeight1 " " vScrollHeight2
return
paik1002 wrote:Sorry, but I have no idea how those links you provided can help detect scrollability of a certain classNN, e.g. Internet Explorer_Server1, DirectUIHWND3, SysTreeView321, _WwG1, etc.
Code: Select all
Gui, 1:+hwndID1
Gui, 1:Add, Tab, +0x200000, General|View|Appearance|Settings
Gui, 1:Add, Tab, -0x200000, General|View|Appearance|Settings
Gui, 1:Show, w400 h400
return
!i::
Loop, 2
{
ControlGet, controlStyle%a_index%, Style,, SysTabControl32%a_index%, % "ahk_id " . ID1
MsgBox % "Tab " . a_index . "is " . ((SuBStr(controlStyle%a_index%, -5, 1) == 2) ? "" : "not") . " scrollable"
}
return
jeeswg wrote:If you try AccViewer on Notepad for example, with no text v. enough text to need the vertical scrollbar, the state is either 'unavailable' or 'normal'.
You can use WBGet to get access to the Internet Explorer_Server control and query scroll information which might give you what you need.
[I'll be able to post some code in maybe half-an-hour.] [EDIT: A few hours later ...]
Note: there is probably a better method for Internet Explorer, this tries to get the amount of the document visible, versus the amount in total, however, there seems to be a rounding issue, so it's not reliable.Code: Select all
e:: ;check for WS_VSCROLL window style WinGet, hWnd, ID, A ControlGetFocus, vCtlClassNN, % "ahk_id " hWnd ControlGet, vCtlStyle, Style,, % vCtlClassNN, % "ahk_id " hWnd MsgBox, % vCtlClassNN "`r`n" "has WS_VSCROLL? " !!(vCtlStyle & 0x200000) ;WS_VSCROLL := 0x200000 return q:: ;Notepad - get vertical scrollbar state ControlGet, hCtl, Hwnd,, Edit1, ahk_class Notepad oAcc := Acc_Get("Object", "5", 0, "ahk_id " hCtl) vChildId := 0 vAccStateNum := oAcc.accState(vChildId) vAccStateNum := Format("0x{:X}", vAccStateNum) vAccStateText := Acc_GetStateText(oAcc.accState(vChildId)) MsgBox, % vAccStateNum " " vAccStateText oAcc := "" return ;w:: ;Internet Explorer - get scroll height WinGet, hWnd, ID, A oWB := WBGet("ahk_id " hWnd) vScrollHeight1 := oWB.document.body.scrollHeight vScrollHeight2 := oWB.document.documentElement.scrollHeight ;vScrollTop := oWB.document.documentElement.scrollTop MsgBox, % vScrollHeight1 " " vScrollHeight2 return
Code: Select all
^+!F12::
{
MouseGetPos,,,, WinClassNN
; Detect if WinClassNN is vertically scrollable. For example,
if WinClassNN and WS_VSCROLL ; Check if a scrollbar exists in WinClassNN (this does not work!)
{
msgbox scrollbar exists for %WinClassNN%
}
return
}
Users browsing this forum: No registered users and 192 guests