JeffHarris Posted July 23, 2007 Author Share Posted July 23, 2007 Ok, let's try a variant of the problem. I can now scroll through the LV control and extract text from each Item, which automatically selects each Item for the duration of the loop. Not a big deal.However, when I attempt to Click on that Item, I cannot get the control to respond. To wit...CODEFunc Customize_Perspective() ; Raise the "Customize Perspective" panel... WinMenuSelectItem("J2EE - IBM Rational Software Development Platform", "", "&Window", "Customi&ze Perspective..." ) ; Focus on the "Customize Perspective" panel... WinWait("Customize Perspective", "") WinActivate("Customize Perspective", "") ; The default tab is "Shortcuts", but we need to be on the "Commands" tab... Send("+{TAB}{RIGHT}") ; We need to process the "Available Command Groups" SysListView control, SysListView322... ControlFocus("Customize Perspective", "", "SysListView322") ; Define an output text file to record debugging processes... $hDisplayFile = 'L:\ITWebSysDoc\Version Control\AutoIt Stuff\AutoIt v3\Script Examples\StarTeamRAD6InterfaceTest\DebugDisplay.txt' FileClose(FileOpen($hDisplayFile, 10)) Local $hDisplay = 'Results of walking through the SysListView322 Controls: ' & @CRLF & @CRLF ; Scan the SysListView322 control... $nLVCHwnd = _Determine_Control_Info("Customize Perspective") $nLVTotal = ControlListView("Customize Perspective", "", "SysListView322", "GetItemCount") $hDisplay &= " ---------------------- " & @CRLF $hDisplay &= " Control handle is " & $nLVCHwnd & @CRLF $hDisplay &= " Number of Items is " & $nLVTotal & @CRLF $hDisplay &= " ---------------------- " & @CRLF & @CRLF ; Locate any/all StarTeam items and see what their status is -- and set them "ON"... For $iLVcnt = 0 to $nLVTotal - 1 $sLVtext = ControlListView("Customize Perspective", "", "SysListView322", "GetText", $iLVcnt, 0) $hDisplay &= "Text from Item " & $iLVcnt & " is " & $sLVtext & @CRLF ; Is this LV Item a StarTeam option? If StringInStr($sLVtext, "StarTeam") Then ; Click the current LV Item... _ListView_ClickItem($nLVCHwnd, $iLVcnt, $PRIMARY) MsgBox(4096, "Debugging...", "Did the _ListView_ClickItem function work for LV Item " & $iLVcnt & "?") EndIf ; Tap the Down Arrow to force the LV control to scroll along with the above edits... Send ("{DOWN}") Next Return FileWrite($hDisplayFile, $hDisplay)EndFuncFunc _Determine_Control_Info($hWnd) If IsString($hWnd) And WinExists($hWnd) Then $hWnd = WinGetHandle($hWnd) Local $aWGCI = _WinGetCtrlInfo($hWnd) If IsArray($aWGCI) = 0 Then Return SetError(1, 0, '') Local $nControlID For $iCC = 1 To $aWGCI[0][0] ControlFocus($hWnd, '', $aWGCI[$iCC][0]) If $aWGCI[$iCC][0] = "SysListView322" Then $nControlID = $aWGCI[$iCC][1] EndIf Next Return $nControlIDEndFunc...and here is what the output debug file is showing...CODEResults of walking through the SysListView322 Controls: ---------------------- Control handle is 2163578 Number of Items is 60 ---------------------- Text from Item 0 is Annotation NavigationText from Item 1 is BreakpointsText from Item 2 is Cheat SheetsText from Item 3 is Compiled DebugText from Item 4 is ConnectorText from Item 5 is Convert Web Project TypeText from Item 6 is Data DefinitionText from Item 7 is DebugText from Item 8 is Editor NavigationText from Item 9 is Editor PresentationText from Item 10 is EJBText from Item 11 is EJBText from Item 12 is EJB DeploymentText from Item 13 is eSupportClient Action SetText from Item 14 is External ToolsText from Item 15 is J2EEText from Item 16 is Java CodingText from Item 17 is Java DebugText from Item 18 is Javadoc with DiagramsText from Item 19 is Java Editor PresentationText from Item 20 is Java Element CreationText from Item 21 is Java NavigationText from Item 22 is Java Open ActionsText from Item 23 is Java SearchText from Item 24 is JUnitText from Item 25 is LaunchText from Item 26 is Open External FilesText from Item 27 is Page Designer EditText from Item 28 is Page Designer FormText from Item 29 is Page Designer FormatText from Item 30 is Page Designer FrameText from Item 31 is Page Designer InsertText from Item 32 is Page Designer Insert JSPText from Item 33 is Page Designer StyleText from Item 34 is Page Designer TableText from Item 35 is Page Designer ToolsText from Item 36 is Page Designer ViewsText from Item 37 is ProcessText from Item 38 is ProfileText from Item 39 is Proxy ToolsText from Item 40 is Resource NavigationText from Item 41 is SampleGalleryActionSetLabelText from Item 42 is SearchText from Item 43 is Search...Text from Item 44 is Serena ProfessionalText from Item 45 is ServerText from Item 46 is Software UpdatesText from Item 47 is Software UpdatesText from Item 48 is SQL/DDL ScriptText from Item 49 is SQL StatementText from Item 50 is StarTeam * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * STARTEAM FOUND !!! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Text from Item 51 is StarTeam Commands * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * STARTEAM FOUND !!! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Text from Item 52 is TeamText from Item 53 is TutorialGalleryActionSetLabelText from Item 54 is View DefinitionText from Item 55 is Web AdvancedText from Item 56 is Web BasicText from Item 57 is Web BrowserText from Item 58 is Web MainText from Item 59 is Web ProjectAnyone have an idea why the _ListView_ClickItem() is not working? The output file shows that I am passing a valid ControlID to the function, highlighted above. Link to comment Share on other sites More sharing options...
JeffHarris Posted July 27, 2007 Author Share Posted July 27, 2007 Ok, I have gotten past all of the above issues with the SysListView control. Not perfect solutions, since I couldn't get some functins to work, but I was still able to make a workable script. I have now moved on to the next panel, which contains a SysTreeView control. At this point, I am simply trying to extract the text from the top level of each node. So far, I get nothing back. Nor can I get a useful count of the number of nodes in the control (whether maximum -allowed value or number-visible value). Here's what I have cobbled together so far: CODE Func Preferences() WinMenuSelectItem("J2EE - IBM Rational Software Development Platform", "", "&Window", "&Preferences" ) ; Raise the "Preferences" panel... WinWait("Preferences", "") WinActivate("Preferences", "") ; Define a few useful variables... Local $hWnd = "Preferences" Local $aWGCI = _WinGetCtrlInfo($hWnd) Local $sClassNameNNN Local $nControlID If $BoolDb Then MsgBox(4096, "Debugging...", "Total number of nodes in the SysTreeView control = " & $aWGCI[0][0]) For $iCC = 1 To $aWGCI[0][0] ControlFocus($hWnd, '', $aWGCI[$iCC][0]) If StringInStr($aWGCI[$iCC][0], "SysTreeView") Then $sClassNameNNN = $aWGCI[$iCC][0] $nControlID = $aWGCI[$iCC][1] If $BoolDb Then MsgBox(4096, "Debugging...", "$sClassNameNNN = " & $sClassNameNNN & ", $nControlID = " & $nControlID) ExitLoop EndIf Next $nNodeCnt = _TreeView_GetVisibleCount($nControlID) ; We need to process the lone SysTreeView control... For $iNC = 1 to $nNodeCnt ; Try to pull the label directly from the SysTreeView control... $TreeVar = _TreeView_GetText($nControlID, $iNC) If $BoolDb Then MsgBox(4096, "Debugging...", "Preference label for Node #" & $iNC & " is " & $TreeVar) ;If $TreeVar = "Team" Then Send("{RIGHT}") ;Send("{DOWN}") Next EndFunc In the above code, I can never get anything to populate the $TreeVar variable. And the $aWGCI[0][0] value contains "43" -- not the 22 unexpanded nodes I physically see on the screen, nor the 100+ subnodes and sub-subnodes I get when manually expanding them all. I have no idea where the "43" is coming from. Any ideas how to tally the number of top-level nodes in a SysTreeView control, how to walk through them, and how to extract the text from each node? 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