qwert Posted September 30, 2016 Share Posted September 30, 2016 Is there a way to determine if a window has a scrollbar displayed? I happen to be working with a browser window, but the question applies to windows, in general. I tried the window info tool, but the parameters are the same with or without a scrollbar. Both IE.3 and FF.au3 have many functions, but I couldn't spot anything related to scrollbars. _IEPropertyGet, for example, can read many characteristics, but, apparently, nothing about the scrollbar. Thanks in advance for any help. Link to comment Share on other sites More sharing options...
jguinch Posted October 2, 2016 Share Posted October 2, 2016 Try _GUIScrollBars_GetScrollInfo Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
qwert Posted October 2, 2016 Author Share Posted October 2, 2016 Quote $hWnd parameter must be the handle to the scroll bar control Thanks for the response. The problem is somewhat of a chicken and egg problem. It's an external window and I'm trying to determine whether it has a scrollbar, or not. Every function in the ScrollBars UDF appears to require the handle to the bar, which may not exist. Do you know of a GetScrollBarHandle function? Link to comment Share on other sites More sharing options...
water Posted October 2, 2016 Share Posted October 2, 2016 I read it that the function needs a handle to the Control which might have a bar. Or am I wrong My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
qwert Posted October 2, 2016 Author Share Posted October 2, 2016 Maybe I read too much into the "must". So it's possible the following will return True if the window has a scroll bar? _GUIScrollBars_GetScrollInfo ( $hWnd, $SB_VERT, $tSCROLLINFO ) I will test that at my next opportunity. Thanks. Link to comment Share on other sites More sharing options...
jguinch Posted October 3, 2016 Share Posted October 3, 2016 (edited) Can you try this code ? It lists all controls in the specified window an uses _GUIScrollBars_GetScrollInfo for each control. It works for me with notepad, but not tested with anoter app. #include <GuiScrollBars.au3> If _WinDetectScrollbar("[Class:Notepad]") Then MsgBox(0, "", "The specified window has a scrollbar") Func _WinDetectScrollbar($sTitle, $sText = "") Local $iCount, $iInstance, $hControl Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO) Local $sClassList = WinGetClassList($sTitle, $sText) If $sClassList = "" Then Return 0 Local $aClasses = StringRegExp($sClassList, "(?m)(^\N+$)(?!(?:\R(?1))*\R\1)", 3) For $i = 0 To UBound($aClasses) - 1 StringRegExpReplace($sClassList, "\Q" & $aClasses[$i] & "\E\R", "") $iCount = @extended For $iInstance = 1 To $iCount $hControl = ControlGetHandle($sTitle, $sText, "[CLASS:" & $aClasses[$i] & "; INSTANCE:" & $iInstance& "]") DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO)) DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL) _GUIScrollBars_GetScrollInfo($hControl, $SB_HORZ, $tSCROLLINFO) If DllStructGetData($tSCROLLINFO, "nMax") >= DllStructGetData($tSCROLLINFO, "nPage") Then Return 1 _GUIScrollBars_GetScrollInfo($hControl, $SB_VERT, $tSCROLLINFO) If DllStructGetData($tSCROLLINFO, "nMax") >= DllStructGetData($tSCROLLINFO, "nPage") Then Return 1 Next Next Return 0 EndFunc Edited October 3, 2016 by jguinch shelly 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
qwert Posted October 3, 2016 Author Share Posted October 3, 2016 Quote I happen to be working with a browser window @jguinch: thanks for your script. I did try it for notepad and it worked. But when I pointed it to Class:MozillaWindowClass, it did not see the scrollbar. There may be complicating factors, like the fact that it's a tabbed browser window. But the AutoIt Window Info tool always shows MozillaWindowClass, which, I assume, represents the open tab. Do you have any suggestions? Link to comment Share on other sites More sharing options...
jguinch Posted October 3, 2016 Share Posted October 3, 2016 _GUIScrollBars_GetScrollInfo and other functions wont work with a Firefox window. Maybe IUIAutomation will be able to give you the info : https://www.autoitscript.com/forum/topic/153520-iuiautomation-ms-framework-automate-chrome-ff-ie/ Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
qwert Posted October 3, 2016 Author Share Posted October 3, 2016 Quote wont work with a Firefox window Well, that's interesting ... and disconcerting. How is a window not a window? But I'll accept that the scroll bar GUI functions won't work. On first glance, IUIAutomation looks, shall I say, rather imposing. At the moment, I don't have time to delve into a whole new realm. So, for now, I guess I'll shelve my idea. Thanks for looking at this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now