Jump to content

Java SWT Eclipse RCP Based Application - Automating with AutoIT


Go to solution Solved by dragan,

Recommended Posts

Hi All,

I am attempting to automate a Java SWT based Eclipse RCP application using AutoIt. I tried searching but couldn't find enough information if AutoIt is a suitable tool for this purpose. Anyways, I went ahead with scripting and using the control handle I'm able to see most of the controls on the eclipse window. However, the left side of the Eclipse has a tree structure and I'm unable to click on them. I tried using ControlTreeView but I guess it is not able to recognise the node that it needs to click on.

'?do=embed' frameborder='0' data-embedContent>> has the solution to one of my earlier questions which I use for getting all the controls on the screen. Only that it is unable to pull out systreeview controls :(

Any help is much appreciated!!

Edited by tester123
Link to comment
Share on other sites

  • Solution

I'm not sure that you can get text from those items, but you can automate them:

 

#include <GuiTreeView.au3>
_Main()

Func _Main()
    Local $EclipseHWND = WinGetHandle('[CLASS:SWT_Window0]')
    If NOT IsHWnd($EclipseHWND) Then
        MsgBox(0, 'Error', 'NO Eclipse winHandle')
        Return SetError(1, 0, 0)
    EndIf
    Local $treeViewCtrl = ControlGetHandle($EclipseHWND, '', "[CLASS:SysTreeView32; INSTANCE:1]")
    If NOT IsHWnd($treeViewCtrl) Then
        MsgBox(0, 'Error', 'no Treeview handle')
        Return SetError(2, 0, 0)
    EndIf
    WinActivate($EclipseHWND)
    Local $totalNoOfItems = _GUICtrlTreeView_GetCount($treeViewCtrl)
    If $totalNoOfItems = 0 Then
        MsgBox(0, 'Error', 'Treeview is empty, there are no items to expand.')
        Return SetError(3, 0, 0)
    Else
        _GUICtrlTreeView_Expand($treeViewCtrl, 0, False)
    EndIf
    MsgBox(0, 'Ready?', 'Script is ready to automate Eclipse''s treeview')
    Local $hFirstItem = _GUICtrlTreeView_GetFirstItem($treeViewCtrl)
    $hItem = _GUICtrlTreeView_GetNext($treeViewCtrl, $hFirstItem)
    _GUICtrlTreeView_EnsureVisible($treeViewCtrl, $hItem)
    MsgBox(0, 'Info', 'First parent is expanded.')
    Local $firstChildCount = _GUICtrlTreeView_GetChildCount($treeViewCtrl, $hFirstItem)
    MsgBox(0, 'Info', 'There are: ' & $firstChildCount & ' first level child elements.')
    $hItem = _GUICtrlTreeView_GetNext($treeViewCtrl, $hItem)
    _GUICtrlTreeView_EnsureVisible($treeViewCtrl, $hItem)
    MsgBox(0, 'Info', 'First child is expanded.')
EndFunc
Link to comment
Share on other sites

  • 4 years later...
On ‎8‎/‎26‎/‎2013 at 1:36 PM, tester123 said:

Brilliant, Thats kinda what i was looking for! Thanks. I'll try to see if I can get the text from them :)

Did this actually work

after 3yrs, I see this one,

Wondering if Auti It has straight way to find theSWT Tree and its methods invoke without much coding?

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...