Sahar Posted July 4, 2016 Share Posted July 4, 2016 I am new to autoit, I have a window contains a list of items and I need to catch each item separately, so I was thinking there should be one way to put these items in an array and work with them, I should mention that the whole window has only one ID and each item on the window doesn't have an individual distinguisher. Would you please guide me that how I can find the control by ID and put all the items in a list or array? Thank you Link to comment Share on other sites More sharing options...
water Posted July 4, 2016 Share Posted July 4, 2016 Welcome to AutoIt and the forum! You need to provide a bit more information for us to help you. Could you please post a screenshot of the window so we know what we are talking about? 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...
Sahar Posted July 4, 2016 Author Share Posted July 4, 2016 I need to have each column in a separate array... Link to comment Share on other sites More sharing options...
Sahar Posted July 4, 2016 Author Share Posted July 4, 2016 Link to comment Share on other sites More sharing options...
water Posted July 4, 2016 Share Posted July 4, 2016 What does the Autoit Window Info Tool display for the table control? ControlId etc. 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...
Sahar Posted July 4, 2016 Author Share Posted July 4, 2016 Link to comment Share on other sites More sharing options...
water Posted July 4, 2016 Share Posted July 4, 2016 You would need something like this: #include <Array.au3> Global $sTitle = "ArrayDisplay" ; <== Set the title of your window here Global $iItemCount = ControlListView($sTitle, "", "[Class:SysListView32]", "GetItemCount") Global $aHeadCode[$iItemCount] Global $aDescription[$iItemCount] Global $aDepart[$iItemCount] For $i = 0 To $iItemCount - 1 $aHeadCode[$i] = ControlListView("ArrayDisplay", "", "[Class:SysListView32]", "GetText", $i, 0) $aDescription[$i] = ControlListView("ArrayDisplay", "", "[Class:SysListView32]", "GetText", $i, 1) $aDepart[$i] = ControlListView("ArrayDisplay", "", "[Class:SysListView32]", "GetText", $i, 2) Next _ArrayDisplay($aHeadCode) _ArrayDisplay($aDescription) _ArrayDisplay($aDepart) Sahar 1 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...
Sahar Posted July 5, 2016 Author Share Posted July 5, 2016 Hi Water, Thanks for your reply, I've tried that code but always $iItemCount iz zero! Global $sTitle = "Timetables" ; <== Set the title of your window here Global $iItemCount = ControlListView($sTitle, "","[Class:SysListView32]", "GetItemCount") Global $aHeadCode[$iItemCount] Global $aDescription[$iItemCount] Global $aDepart[$iItemCount] For $i = 0 To $iItemCount - 1 $aHeadCode[$i] = ControlListView("Timetables", "", "[Class:SysListView32]", "GetText", $i, 0) $aDescription[$i] = ControlListView("Timetables", "", "[Class:SysListView32]", "GetText", $i, 1) $aDepart[$i] = ControlListView("Timetables", "", "[Class:SysListView32]", "GetText", $i, 2) Next _ArrayDisplay($aHeadCode) _ArrayDisplay($aDescription) _ArrayDisplay($aDepart) Link to comment Share on other sites More sharing options...
Sahar Posted July 5, 2016 Author Share Posted July 5, 2016 Do I need to mention control ID which is "1310" in ControlListView ? now we haven't addressed which control do we want to be found... Link to comment Share on other sites More sharing options...
Synapsee Posted July 5, 2016 Share Posted July 5, 2016 Global $sTitle = "Timetables" ; <== Set the title of your window here I think your problem is here. With your screenshot on post #6, windows info Title seems be "" and not "Timetables". Maybe u can try ControlListView but with winhandle ? Sample : Local $hHWiNFO = WinGetHandle("[REGEXPTITLE:HWiNFO(.*) Sensor Status]") consolewrite($hHWiNFO & @CRLF); this return 0x00090376 Global $iItemCount = ControlListView($hHWiNFO, "", "[Class:SysListView32]", "GetItemCount") consolewrite($iItemCount & @CRLF); this return 112 Link to comment Share on other sites More sharing options...
Sahar Posted July 5, 2016 Author Share Posted July 5, 2016 When I am using : Local $hHWiNFO = WinGetHandle("[REGEXPTITLE:HWiNFO(.*) Sensor Status]") window handle is coming as 0x00000000 Link to comment Share on other sites More sharing options...
water Posted July 5, 2016 Share Posted July 5, 2016 Can you please post the "Window" tab from the AutoIt Window Info Tool? So we get as much information about the window as possible. 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...
Synapsee Posted July 5, 2016 Share Posted July 5, 2016 Quote When I am using : Local $hHWiNFO = WinGetHandle("[REGEXPTITLE:HWiNFO(.*) Sensor Status]") window handle is coming as 0x00000000 it's just a sample u need adapt it for u. u can probably look around winlist, etc... anyway @water suggest are good, give us a screenshot with Quote "Window" tab from the AutoIt Window Info Tool Sahar 1 Link to comment Share on other sites More sharing options...
water Posted July 5, 2016 Share Posted July 5, 2016 Thre screenshot from post #11 shows that the window does not have a title ("Basic Window Info"). So it seems you need to use the Class: Global $iItemCount = ControlListView([CLASS:#32770], "", "[Class:SysListView32]", "GetItemCount") Sahar 1 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...
Sahar Posted July 6, 2016 Author Share Posted July 6, 2016 As you've advised I used class in ControlListView but I am receiving syntax error! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 6, 2016 Moderators Share Posted July 6, 2016 That would be because you didn't surround the parameter in quotes. Should be "[CLASS:#32770]" Sahar 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Sahar Posted July 6, 2016 Author Share Posted July 6, 2016 Thanks JLogan3o13, I've put double quotes so there isn't syntax error anymore but $iItemCount is displayed as zero! MsgBox("","",$iItemCount) Link to comment Share on other sites More sharing options...
Synapsee Posted July 6, 2016 Share Posted July 6, 2016 #include <Array.au3>; for _ArrayDisplay $aWinList = WinList("[CLASS:#32770]") _ArrayDisplay($aWinList) For $i = 1 to $aWinList[0][0] ;If $aWinList[$i][0] = "" Then $iItemCount = ControlListView($aWinList[$i][1], "", "[Class:SysListView32]", "GetItemCount") ConsoleWrite($iItemCount & @CRLF) ;EndIf Next Sahar 1 Link to comment Share on other sites More sharing options...
mikell Posted July 6, 2016 Share Posted July 6, 2016 (edited) Many #32770 windows exist in the background, so you might check first which one is visible #include <Array.au3>; for _ArrayDisplay $aWinList = WinList("[CLASS:#32770]") ;_ArrayDisplay($aWinList) Local $handle For $i = 1 to $aWinList[0][0] If BitAND(WinGetState($aWinList[$i][1]), 2) Then ; is the window visible ? $handle = $aWinList[$i][1] Exitloop EndIf Next $iItemCount = ControlListView($handle, "", "[Class:SysListView32; INSTANCE:1]", "GetItemCount") Msgbox(0,"", $iItemCount) ; etc Edited July 6, 2016 by mikell many typos :) Sahar 1 Link to comment Share on other sites More sharing options...
Sahar Posted July 8, 2016 Author Share Posted July 8, 2016 (edited) Thanks everybody, now I am able to put each column in an array and work with it, this is the code that is working for me and you guys helped me alot to write: $aWinList = WinList("[CLASS:#32770]") Local $handle For $i = 1 to $aWinList[0][0] If BitAND(WinGetState($aWinList[$i][1]), 2) Then ; is the window visible ? $handle = $aWinList[$i][1] Exitloop EndIf Next $iItemCount = ControlListView($handle, "", "[Class:SysListView32; INSTANCE:1]", "GetItemCount") Global $aHeadCode[$iItemCount] Global $aDescription[$iItemCount] Global $aDepart[$iItemCount] For $i = 0 To $iItemCount - 1 $aHeadCode[$i] = ControlListView($handle, "", "[Class:SysListView32; INSTANCE:1]", "GetText", $i, 0) $aDescription[$i] = ControlListView($handle, "", "[Class:SysListView32]", "GetText", $i, 1) $aDepart[$i] = ControlListView($handle, "", "[Class:SysListView32]", "GetText", $i, 2) Next _ArrayDisplay($aHeadCode) _ArrayDisplay($aDescription) _ArrayDisplay($aDepart) Edited July 8, 2016 by Sahar 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