erez135 Posted July 19, 2009 Share Posted July 19, 2009 (edited) Hi, I am running "devmgmt.msc" - windows application. I want to get the item's property. _GUICtrlTreeView_ClickItem - work's fine _GUICtrlTreeView_GetFirstChild - work's fine _GUICtrlTreeView_GetSelection - work's fine Now: I need the item name / description that i am click on using : _GUICtrlTreeView_GetText - but i can't get it work. I am try ControlTreeView function (get text) also - but i am fail to get the item text. I will appreciate any help. Thanks in advanced Erez. Edited July 19, 2009 by erez135 Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 Could you please post your code so we can have a look at it? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erez135 Posted July 19, 2009 Author Share Posted July 19, 2009 Thanks... #include "repository.au3" #Include <GuiTreeView.au3> ShellExecute("D:\WINDOWS\system32\devmgmt.msc ") WinActive("Device Manager") Sleep(1000) WinActivate ("Device Manager") Sleep(200) $wHndle=WinGetHandle("Device Manager") $hTree=ControlGetHandle($wHndle,"","[CLASS:SysTreeView32; INSTANCE:1]") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hTree = ' & $hTree & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console Sleep(100) $node_first_item = _GUICtrlTreeView_GetFirstItem($hTree) $node_first_child = _GUICtrlTreeView_GetFirstChild($hTree,$node_first_item) _GUICtrlTreeView_ClickItem($hTree, $node_first_child) Sleep(300) $h_lsti=_GUICtrlTreeView_GetFirstChild($hTree, $node_first_item) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $h_lsti = ' & $h_lsti & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console _GUICtrlTreeView_ClickItem($hTree, $h_lsti) Sleep(1000) $tx=_GUICtrlTreeView_GetText($node_first_child) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $tx = ' & $tx & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 The handle to the control was missing. So please change line $tx=_GUICtrlTreeView_GetText($node_first_child)to$tx=_GUICtrlTreeView_GetText($hTree,$node_first_child) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erez135 Posted July 19, 2009 Author Share Posted July 19, 2009 Thanks for reply water. I change it. but still i don't get it work. I recive empty string (""); Thanks again Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 I stripped down your script and this works fine for me: #Include <GuiTreeView.au3> ShellExecute("D:\WINDOWS\system32\devmgmt.msc ") WinWait("Device Manager") WinActivate ("Device Manager") $wHndle=WinGetHandle("Device Manager") $hTree=ControlGetHandle($wHndle,"","[CLASS:SysTreeView32; INSTANCE:1]") $node_first_item = _GUICtrlTreeView_GetFirstItem($hTree) $node_first_child = _GUICtrlTreeView_GetFirstChild($hTree,$node_first_item) $tx=_GUICtrlTreeView_GetText($hTree,$node_first_child) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $tx = ' & $tx & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erez135 Posted July 19, 2009 Author Share Posted July 19, 2009 I copy/paste your script. run it. at application pop up. but the results : >"D:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\Documents and Settings\Administrator\Desktop\driver_restart\test.au3" /autoit3dir "D:\Program Files (x86)\AutoIt3" /UserParams +>15:19:02 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0409 Keyboard:00000409 OS:WIN_2003/Service Pack 2 CPU:X64 ANSI) >Running AU3Check (1.54.14.0) from:D:\Program Files (x86)\AutoIt3 +>15:19:02 AU3Check ended.rc:0 >Running:(3.3.0.0):\Program Files (x86)\AutoIt3\autoit3.exe "D:\Documents and Settings\Administrator\Desktop\driver_restart\test.au3" @@ Debug(10) : $tx = >Error code: 0 +>15:19:03 AutoIT3.exe ended.rc:0 +>15:19:05 AutoIt3Wrapper Finished >Exit code: 0 Time: 2.744 i am working on windows 2003 server 64 bit SP2-2. could it be that i installed wrong autoit version ? or autoit not supported this O.S ? maybe the installation directory path - D:\Program Files (x86)\AutoIt3 is the problem ? Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 So far everything looks fine to me. I've inserted some to see where the problem is:#Include <GuiTreeView.au3> ShellExecute("D:\WINDOWS\system32\devmgmt.msc ") $RC = WinWait("Device Manager") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $RC = ' & $RC & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $RC = WinActivate ("Device Manager") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $RC = ' & $RC & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $wHndle=WinGetHandle("Device Manager") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $wHndle = ' & $wHndle & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $hTree=ControlGetHandle($wHndle,"","[CLASS:SysTreeView32; INSTANCE:1]") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hTree = ' & $hTree & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $node_first_item = _GUICtrlTreeView_GetFirstItem($hTree) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $node_first_item = ' & $node_first_item & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $node_first_child = _GUICtrlTreeView_GetFirstChild($hTree,$node_first_item) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $node_first_child = ' & $node_first_child & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $tx=_GUICtrlTreeView_GetText($hTree,$node_first_child) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $tx = ' & $tx & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $RC = WinClose($wHndle) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $RC = ' & $RC & @crlf & '>Error code: ' & @error & @crlf) ;### Debug ConsoleI'm running Autoit 3.3.0.0 on Windows XP SP2 German, so my code and environment is a bit different. Could you please post the Console after running my code? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erez135 Posted July 19, 2009 Author Share Posted July 19, 2009 Thanks .. >"D:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\Documents and Settings\Administrator\Desktop\driver_restart\test.au3" /autoit3dir "D:\Program Files (x86)\AutoIt3" /UserParams +>15:58:05 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0409 Keyboard:00000409 OS:WIN_2003/Service Pack 2 CPU:X64 ANSI) >Running AU3Check (1.54.14.0) from:D:\Program Files (x86)\AutoIt3 +>15:58:05 AU3Check ended.rc:0 >Running:(3.3.0.0):\Program Files (x86)\AutoIt3\autoit3.exe "D:\Documents and Settings\Administrator\Desktop\driver_restart\test.au3" @@ Debug(4) : $RC = 1 >Error code: 0 @@ Debug(6) : $RC = 1 >Error code: 0 @@ Debug(8) : $wHndle = 0x0009012E >Error code: 0 @@ Debug(10) : $hTree = 0x00060178 >Error code: 0 @@ Debug(12) : $node_first_item = 0x038C3010 >Error code: 0 @@ Debug(14) : $node_first_child = 0x038C37C0 >Error code: 0 @@ Debug(16) : $tx = >Error code: 0 @@ Debug(18) : $RC = 1 >Error code: 0 +>15:58:07 AutoIT3.exe ended.rc:0 +>15:58:08 AutoIt3Wrapper Finished >Exit code: 0 Time: 2.771 Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 That's crazy Could you please expand the TreeView to the item you want to get the text of and post a ScreenShot? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Authenticity Posted July 19, 2009 Share Posted July 19, 2009 #include <GUITreeView.au3> ShellExecute('devmgmt.msc') WinWaitActive('Device Manager') $hWnd = WinGetHandle('Device Manager') $hTree = ControlGetHandle($hWnd, '', 'SysTreeView321') $hItem = _GUICtrlTreeView_GetFirstItem($hTree) ConsoleWrite(_GUICtrlTreeView_GetText($hTree, $hItem) & @LF) $hItem = _GUICtrlTreeView_GetFirstChild($hTree, $hItem) ConsoleWrite(_GUICtrlTreeView_GetText($hTree, $hItem) & @LF) Link to comment Share on other sites More sharing options...
erez135 Posted July 19, 2009 Author Share Posted July 19, 2009 (edited) water, without any relation to the results of this session, i would like to thank you for your effort and time. I need to open "mellanox Connectx Adapters" and to enable /disable the driver - in loop see attached file. Edited July 19, 2009 by erez135 Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 Hi erez135, glad to be of service. I have received so much support from this forum myself that I would like to return some of the time and effort. Everything looks fine to me. Maybe there is a bug in the 64Bit version of AutoIt Do you have a 32Bit Windows server available to test it there? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erez135 Posted July 19, 2009 Author Share Posted July 19, 2009 Yes - it is working 100% on win2003 32 bit. Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 (edited) OK, another approach. Lets directly search for the item you are looking for: #Include <GuiTreeView.au3> ShellExecute("D:\WINDOWS\system32\devmgmt.msc ") $RC = WinWait("Device Manager") $RC = WinActivate ("Device Manager") $wHndle=WinGetHandle("Device Manager") $hTree=ControlGetHandle($wHndle,"","[CLASS:SysTreeView32; INSTANCE:1]") $hItemFound = _GUICtrlTreeView_FindItem($hTree, "Mellanox ConnectX Adapters") If $hItemFound Then MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTree, $hItemFound)) Else MsgBox(4160, "Information", "Not Found") EndIf $RC = WinClose($wHndle) Does it work? Edited July 19, 2009 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erez135 Posted July 19, 2009 Author Share Posted July 19, 2009 I try it. and the information box appear " Not Found" message appear. Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 Could you test this new code on the 32bit server as well? Just to be sure there is no bug in my code. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 (edited) Could you please have a look in the AutoIt help file -> Autoit -> Using AutoIt -> Running under Windows 4-bit Edition? Have you beend asked at installation time to install the x64 version of AutoIt? If yes, then I think you are out of luck (for the moment) because the GuiTreeView UDF uses DLL calls a lot. As the script runs fine on 32Bit systems I think you'll have to post a bug report as suggested in the help file. Edited July 19, 2009 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
erez135 Posted July 19, 2009 Author Share Posted July 19, 2009 Yes - i install it under 64 bit. I will post a bug report as you suggested. I will develope the application under win2003 32 bit at the current time. I would like to Thank you again for your time and your patience . This forum is very good and strong - thanks to people like you Thanks and "shalom" Erez Link to comment Share on other sites More sharing options...
water Posted July 19, 2009 Share Posted July 19, 2009 Shalom and greetings from Austria Thomas My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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