DnyJadhav Posted January 3, 2020 Posted January 3, 2020 I am working on a task using AutoIT tool where I need to traverse through the tree structure of the Computer Management to one of the services(in this case it is CDB Services) and verify message in information levels for that service. Tree view is as Computer Management tool -> Computer Management(Local)->System Tools->Event Viewer->Application and Services logs->CDB service I am trying with ControlTreeView function with ‘Select’ / 'Expand' command in the script. Script as follow: ShellExecute("compmgmt.msc") ControlTreeView ("Computer Management", "",12785, "Select", "Computer Management(Local)|System Tools|Event Viewer|Applications and Services Logs|CDB Services") Above script is not working. Can someone please help..
Moderators Melba23 Posted January 3, 2020 Moderators Posted January 3, 2020 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Nine Posted January 3, 2020 Posted January 3, 2020 This is working for me : #RequireAdmin #include <Constants.au3> Opt ("MustDeclareVars", 1) ShellExecute ("compmgmt.msc") Local $hWnd = WinWaitActive ("[CLASS:MMCMainFrame]") Local $hCtrl = ControlGetHandle ($hWnd, "", "SysTreeView321") ControlTreeView ($hWnd, "", $hCtrl, "Expand", "#0|#0|#1") Sleep (800) ControlTreeView ($hWnd, "", $hCtrl, "Expand", "#0|#0|#1|#2") Sleep (800) ControlTreeView ($hWnd, "", $hCtrl, "Select", "#0|#0|#1|#2") Sleep (800) ControlTreeView ($hWnd, "", $hCtrl, "Select", "#0|#0|#1|#2|#2") “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
DnyJadhav Posted January 8, 2020 Author Posted January 8, 2020 Thanks for providing solutions using instances to traverse the tree structure and it is working fine. I am trying to use labels instead of instances in control tree view but it is not working. Below is the scripts #RequireAdmin #include <Constants.au3> #include <GuiTreeView.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> Opt ("MustDeclareVars", 1) ShellExecute ("compmgmt.msc") Sleep(2000) Local $hWnd =WinWaitActive ("[CLASS:MMCMainFrame]") Local $hCtrl = ControlGetHandle ($hWnd, "", "SysTreeView321") Sleep(2000) ControlTreeView($hWnd, "", $hCtrl, "Expand", "Computer Management(Local)|System Tools|Event Viewer") Sleep(2000) ControlTreeView ($hWnd, "", $hCtrl, "Expand", "Computer Management(Local)|System Tools|Event Viewer|Applications and Services Logs") Sleep(2000) ControlTreeView ($hWnd, "", $hCtrl, "Select", "Computer Management(Local)|System Tools|Event Viewer|Applications and Services Logs") Sleep(2000) ControlTreeView ($hWnd, "", $hCtrl, "Select", "Computer Management(Local)|System Tools|Event Viewer|Applications and Services Logs|CDB Services") Sleep(5000) WinClose("Computer Management") Could you please help me and let me know if I am doing it in a wrong way. Thanks in advance for your help.
Nine Posted January 8, 2020 Posted January 8, 2020 I have a french OS. So I cannot replicate your code. This is the main reason why I decided to use indexes. Also if you miss one single character, like a space or anything else, it will not work. I believe it must be your case. To solve your problem you could request commands of "GetText" to ensure you got the proper naming of each labels. Put the names in the console then copy/paste them in your code. Should work... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
DnyJadhav Posted January 8, 2020 Author Posted January 8, 2020 Thanks for your response. I copied the path from visible text in AutoIt Window info and replaced '\' with '|' in then used in ControlTreeView command. I also tried to display error after execution of below statement. It displayed error on the message box. ControlTreeView($hWnd, "", $hCtrl, "Expand", "Computer Management (Local)|System Tools|Event Viewer") if @error Then MsgBox(4096, '', 'Error',2) EndIf Not able to find exact issue in the code. Can you please let me know how we can debug code in autoIT. That will be a great help. Below is complete script: #RequireAdmin #include <Constants.au3> #include <GuiTreeView.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> Opt ("MustDeclareVars", 1) ShellExecute ("compmgmt.msc") Sleep(2000) Local $hWnd =WinWaitActive ("[CLASS:MMCMainFrame]") Local $hCtrl = ControlGetHandle ($hWnd, "", "SysTreeView321") Sleep(2000) ControlTreeView($hWnd, "", $hCtrl, "Expand", "Computer Management (Local)|System Tools|Event Viewer") if @error Then MsgBox(4096, '', 'Error',2) EndIf Sleep(2000) ControlTreeView ($hWnd, "", $hCtrl, "Expand", "Computer Management (Local)|System Tools|Event Viewer|Applications and Services Logs") Sleep(2000) ControlTreeView ($hWnd, "", $hCtrl, "Select", "Computer Management (Local)|System Tools|Event Viewer|Applications and Services Logs") Sleep(2000) Local $sText = ControlTreeView ($hWnd, "", $hCtrl, "GetText", "Computer Management (Local)|System Tools|Event Viewer|Applications and Services Logs|CDB Services") MsgBox(4096, '', $sText,2) Sleep(5000) WinClose("Computer Management")
Nine Posted January 8, 2020 Posted January 8, 2020 When you post code, please, use this tool. Why is it SO important to use labels instead of indexes ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
DnyJadhav Posted January 8, 2020 Author Posted January 8, 2020 Apologies for posting script in plain text format. I will follow forum rule for posting the script. Thanks. Actually, I need to verify if the CDB service is installed on the machine first. If it is installed then I need to do validation on information messages under Level for CDB services. As per my understanding index of CDB service can vary on machine to machine. If it is so then traversing tree structure using indexes will fail.
Nine Posted January 8, 2020 Posted January 8, 2020 I see. Well I checked and got also problem using labels. Solution, it must be runned x64. See ControlView remarks : "As AutoIt is a 32-bit application some commands are not available when referencing a 64-bit application as Explorer when running on 64-bit Windows." “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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