Jump to content
PravinShinde

How to access listbox in java using javaIT4xjava jar

Recommended Posts

PravinShinde

 

i am able to access listbox successfully in autoscript but facing problem while accessing in java using javaITx4java jar 
Please find code for autoIT script


#include <GuiListBox.au3>
Dim $winhandle
Dim $hdlList
Local $appTitle="PROKEY - NK1: [keine Datei geladen]";
Local $entryDialogTitle="InputAccel-Dokumentenliste";
ControlFocus($appTitle,"","SVWORK2")
WinWaitActive($appTitle)
Sleep(2000)
WinMenuSelectItem($appTitle,"","EAntrag","Stapel auswählen")
Sleep(2000)
Local $diawin = WinGetHandle($entryDialogTitle)
Local $cidListActive = "[CLASS:ListBox; INSTANCE:1]"
If Not IsHWnd($diawin) Then
    ConsoleWrite("not handle $diawin")
   Exit
Else
              ;MsgBox("handle","","")
              ConsoleWrite("handle $diawin"&@CRLF)
EndIf
$hdlList = ControlGetHandle($diawin, "",$cidListActive)
If Not IsHWnd($hdlList) Then
   ConsoleWrite("not handle $hdlList")
   Exit
Else
               ConsoleWrite("handle $hdlList"&@CRLF)
EndIf
   Local $num =  _GUICtrlListBox_GetCount($hdlList)
ConsoleWrite("num  "&$num&@CRLF)
 
 
For $i = 0 To $num-1 Step 1
              Local $itemText = _GUICtrlListBox_GetText($hdlList,$i)
              ConsoleWrite($itemText&@CRLF)
             If $itemText=="MMM_KL20190104_94909" Then
                        _GUICtrlListBox_ClickItem($hdlList,$i)
 
                        ExitLoop
              EndIf
Next
 
ConsoleWrite()
;Local $selItem = _GUICtrlListBox_ClickItem($hdlList,1)
ControlClick($entryDialogTitle,"OK","Button2")

check code for java using autoitxjava
 String appTitle="PROKEY - NK1: [keine Datei geladen]";

             String entryDialogTitle="InputAccel-Dokumentenliste";

             final String JACOB_DLL_TO_USE = System.getProperty("sun.arch.data.model").contains("32") ? "jacob-1.19-x86.dll" : "jacob-1.19-x64.dll";          

             File file = new File(System.getProperty("user.dir")+"\\alib",JACOB_DLL_TO_USE);

             System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());           

             AutoItX control = new AutoItX();

             Utility.isProcessOpen();

             Utility.openApp(driver, service);

             control.controlFocus(appTitle,"","SVWORK2");

             control.winWaitActive(appTitle);

             control.winMenuSelectItem(appTitle,"","EAntrag","Stapel auswählen");

i have mention both code here issue is accessing listbox in java

  1.  

Share this post


Link to post
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

×