Jump to content
Sign in to follow this  
KhalidAnsari

Could not find Java Application control name

Recommended Posts

KhalidAnsari

Hi,

I need to automate Java application using AutoIt, I have refer forum for the same, as per forum I am using Java Access Bridge to finding control name. But could not set value to control. Below is my sample code 

Send("#r")
sleep(1500)
Send("D:\javaapplication\javaapplication\Hello.jar{Enter}")
WinActivate("Penjumlahan")
sleep(1500)
ControlSetText("Penjumlahan", "", "Name:  A :", "demo")

Java Application and Java Ferret screen

image.png.96be2b7498ff92422338258b71357a91.png

Share this post


Link to post
Share on other sites
caramen

Try to use the search fonction of the forum. 

 

Search this without dot : 

IUIAutomation learning 

You will have all answer needed.

Or watch my signature.

Edited by caramen

IUIAutomation From Junkew || WebDriver From Danp2 || And Water's UDF in the Quote|| >>HIt The Thanks Button.<<

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Aether

I don't think "Name: " should be there, remove it.

Share this post


Link to post
Share on other sites
caramen
7 minutes ago, Aether said:

I don't think "Name: " should be there, remove it.

Java application cannot being automated with autoit. Even with the most correct syntax he wont be able to get it work.


IUIAutomation From Junkew || WebDriver From Danp2 || And Water's UDF in the Quote|| >>HIt The Thanks Button.<<

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
KhalidAnsari

Hi,

Thanks for the reply.

I tried removing  Name : still I am not able to set value. My Java Ferret screen is erroring out went i move mouse on my java application.  Also I will look into IUIAutomation.  

Any more help will be appreciated. 

Thanks

 

Share this post


Link to post
Share on other sites
KhalidAnsari

@JLogan3o13 Ok. It was done by mistake.

Share this post


Link to post
Share on other sites
junkew

just checked source is still running fine using windows 10 and au3 3.3.14.15

>Running:(3.3.14.5)
C:\Program Files\Java\jre1.8.0_181
We are using X64 at cpu X64 Autoit 64 bit version 1
  Windows accessbridge 32 opened 1
 0 initializeAccessBridge is finishedWindows_run passed :
0hello  name: <About...>
  description: <<html>View information about this version of the JRE</html>>
  role: <push button>
  role_en_US: <push button>
  states: <enabled,focusable,visible,showing,opaque>
  states_en_US: <enabled,focusable,visible,showing,opaque>
  indexInParent: <0>
  childrenCount: <0>
  x: <1126>
  y: <277>
  width: <73>
  height: <0>

 

Share this post


Link to post
Share on other sites
KhalidAnsari

Hi,

@junkew I tried this https://www.autoitscript.com/forum/topic/166830-java-object-automation-and-simple-spy 

I am using simplespy but i coud not get info apart from title name where was JFrame contain button and textbox. Is I am doing anything wrong. JAB Spy is not showing info I have already enable jabswitch. I am using windows 10 and jdk ver 1.8.

I have gone through IUIAutomation link as well.  

Please let kwn where I am going wrong. 

Thanks in advance. Below is my screen detail based on simplespy.

image.thumb.png.20af4f77354b4a484ea47c8349390aa0.png

 

Share this post


Link to post
Share on other sites
junkew

Iuiautomation will only recognize main java window and nothing inside. For jabsimplespy you should compile it first and run as exe. I have sen situations where it will not work from the ide. And probably you have to play and tweak with 32 and 64 bits jab dll. Get it first working on java configuration window.

Share this post


Link to post
Share on other sites
KhalidAnsari

Hi,

@junkew  Thanks for reply.  I am using Java 64 bit. i have combile jabsimplespy then run as exe it erroring out. Stating jabsimplyspy stopped working. How can I recognize inside control of java window. i am trying Iuiautomation _UIA_getObjectByFindAll , _UIA_getText and _UIA_setText.

Thanks for helping.

Share this post


Link to post
Share on other sites
caramen

@KhalidAnsari Do you did what i said you ?


IUIAutomation From Junkew || WebDriver From Danp2 || And Water's UDF in the Quote|| >>HIt The Thanks Button.<<

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
KhalidAnsari

Hi,

Thanks for reply.

Yes i did it. Still I am not able to get it. I Below is my code. I can able to set focus on title bar but i could not set focus on textbox and set value. 

Please let me kwn if am doing wrong.

Thanks

#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)
Sleep(5000)
_UIA_setVar("oP1","Title:=Penjumlahan;controltype:=UIA_WindowControlTypeId;class:=SunAwtFrame")
_UIA_setVar("oUIElement","Title:=;controltype:=UIA_TitleBarControlTypeId;class:=") ;ControlType:=UIA_TitleBarControlTypeId;classname:=")
_UIA_Action("oP1","setfocus")
_UIA_action("oUIElement","highlight")
MsgBox(0, "", "Hello")

 

Share this post


Link to post
Share on other sites
caramen

So you are able to set focus to Grand Parent > Parent > Child window ? 

 

You are able to see your item but you can't play with it ? 

You not able to see your item ?


IUIAutomation From Junkew || WebDriver From Danp2 || And Water's UDF in the Quote|| >>HIt The Thanks Button.<<

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
KhalidAnsari

Yes, I can able to set focus on Grand Parent > Parent > but for child window i cannot able to get control name and set focus as well.  I can able to see the item of parent window only for inner textbox and button when i set coursor I did not show details.

Thanks

 

Share this post


Link to post
Share on other sites
caramen

Can you show me ONLY the wanted control + the simplespy windows with WANTED CONTROL's simplespy information please ?

Full windows of both application please. not only a part.

 

Also when you hit CTRL+W Does the wanted control or somthing else is hightlighted ?

Edited by caramen

IUIAutomation From Junkew || WebDriver From Danp2 || And Water's UDF in the Quote|| >>HIt The Thanks Button.<<

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
KhalidAnsari

Hi @caramen

Thanks for reply. Please help and correct me.

Below is my java screen. It has control like textbox and button. 

image.png.a9c939276a6d1d879d015a4ef93f5877.png

------------------------------------------------------------------------------------------------------------------------------------

My au3 script for setting focus and setting value in control which i could not able to find and set it.

;#RequireAdmin
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)
WinWaitActive("Penjumlahan")
Local $oP3=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Penjumlahan;controltype:=UIA_WindowControlTypeId;class:=SunAwtFrame", $treescope_children)
_UIA_Action($oP3,"setfocus")
Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=Penjumlahan;controltype:=UIA_PaneControlTypeId;class:=", $treescope_children)
_UIA_Action($oP2,"setfocus")
Local $oUIElement=_UIA_getObjectByFindAll($oP3, "title:=;ControlType:=UIA_PaneControlTypeId", $treescope_subtree)
_UIA_action($oUIElement,"highlight")
;~_UIA_action($oUIElement,"click")
;~_UIA_action($oUIElement,"setvalue", "ABCDE9999F")

----------------------------------------------------------------------------------------------------------------

Code snippet of SimpleSpy window. I cannot able to find my child control detail. When i keep my mouse pointer on control and press ctrl+w simplespy give me the detail of desktop window. 

#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

Local $oP0=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Penjumlahan;controltype:=UIA_WindowControlTypeId;class:=SunAwtFrame", $treescope_children)    
_UIA_Action($oP0,"setfocus")
;~ First find the object in the parent before you can do something
;~$oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_TitleBarControlTypeId", $treescope_subtree)
Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_TitleBarControlTypeId", $treescope_subtree)
;~_UIA_action($oUIElement,"highlight")
_UIA_action($oUIElement,"click")


*** Detailed properties of the highlighted element ***
UIA_iaccessiblevalue:= <Penjumlahan>
UIA_iaccessiblechildId:= <0>
UIA_handle:= <0>
UIA_RuntimeId:= <42;328950;1;-2147483647;328950;-2;0>
UIA_BoundingRectangle:= <888;197;378;23>
UIA_ProcessId:= <580>
UIA_ControlType:= <50037>
UIA_LocalizedControlType:= <title bar>
UIA_HasKeyboardFocus:= <False>
UIA_IsKeyboardFocusable:= <True>
UIA_IsEnabled:= <True>
UIA_Culture:= <0>
UIA_IsControlElement:= <True>
UIA_IsContentElement:= <False>
UIA_IsPassword:= <False>
UIA_NativeWindowHandle:= <0>
UIA_IsOffscreen:= <False>
UIA_Orientation:= <0>
UIA_IsRequiredForForm:= <False>
UIA_IsDockPatternAvailable:= <False>
UIA_IsExpandCollapsePatternAvailable:= <False>
UIA_IsGridItemPatternAvailable:= <False>
UIA_IsGridPatternAvailable:= <False>
UIA_IsInvokePatternAvailable:= <False>
UIA_IsMultipleViewPatternAvailable:= <False>
UIA_IsRangeValuePatternAvailable:= <False>
UIA_IsScrollPatternAvailable:= <False>
UIA_IsScrollItemPatternAvailable:= <False>
UIA_IsSelectionItemPatternAvailable:= <False>
UIA_IsSelectionPatternAvailable:= <False>
UIA_IsTablePatternAvailable:= <False>
UIA_IsTableItemPatternAvailable:= <False>
UIA_IsTextPatternAvailable:= <False>
UIA_IsTogglePatternAvailable:= <False>
UIA_IsTransformPatternAvailable:= <False>
UIA_IsValuePatternAvailable:= <True>
UIA_IsWindowPatternAvailable:= <False>
UIA_ValueValue:= <Penjumlahan>
UIA_ValueIsReadOnly:= <False>
UIA_RangeValueValue:= <0>
UIA_RangeValueIsReadOnly:= <True>
UIA_RangeValueMinimum:= <0>
UIA_RangeValueMaximum:= <0>
UIA_RangeValueLargeChange:= <0>
UIA_RangeValueSmallChange:= <0>
UIA_ScrollHorizontalScrollPercent:= <0>
UIA_ScrollHorizontalViewSize:= <100>
UIA_ScrollVerticalScrollPercent:= <0>
UIA_ScrollVerticalViewSize:= <100>
UIA_ScrollHorizontallyScrollable:= <False>
UIA_ScrollVerticallyScrollable:= <False>
UIA_SelectionCanSelectMultiple:= <False>
UIA_SelectionIsSelectionRequired:= <False>
UIA_GridRowCount:= <0>
UIA_GridColumnCount:= <0>
UIA_GridItemRow:= <0>
UIA_GridItemColumn:= <0>
UIA_GridItemRowSpan:= <1>
UIA_GridItemColumnSpan:= <1>
UIA_DockDockPosition:= <5>
UIA_ExpandCollapseExpandCollapseState:= <3>
UIA_MultipleViewCurrentView:= <0>
UIA_WindowCanMaximize:= <False>
UIA_WindowCanMinimize:= <False>
UIA_WindowWindowVisualState:= <0>
UIA_WindowWindowInteractionState:= <0>
UIA_WindowIsModal:= <False>
UIA_WindowIsTopmost:= <False>
UIA_SelectionItemIsSelected:= <False>
UIA_TableRowOrColumnMajor:= <2>
UIA_ToggleToggleState:= <2>
UIA_TransformCanMove:= <False>
UIA_TransformCanResize:= <False>
UIA_TransformCanRotate:= <False>
UIA_IsLegacyIAccessiblePatternAvailable:= <True>
UIA_LegacyIAccessibleChildId:= <0>
UIA_LegacyIAccessibleValue:= <Penjumlahan>
UIA_LegacyIAccessibleDescription:= <Displays the name of the window and contains controls to manipulate it>
UIA_LegacyIAccessibleRole:= <1>
UIA_LegacyIAccessibleState:= <1048576>
UIA_IsDataValidForForm:= <False>
UIA_ProviderDescription:= <[pid:6536,hwnd:0x0 Annotation:Microsoft: Annotation Proxy (unmanaged:uiautomationcore.dll); Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]>
UIA_IsItemContainerPatternAvailable:= <False>
UIA_IsVirtualizedItemPatternAvailable:= <False>
UIA_IsSynchronizedInputPatternAvailable:= <False>

Edited by KhalidAnsari

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
Sign in to follow this  

  • Similar Content

    • gahhon
      By gahhon
      Hi,
      I have a program that is read data from the .txt file, since the .txt file is only readable, viewable and editable for the admin user.
      But how could I lock it with password, or some other technique that can helps to achieve this?
      Thanks for the advanced information.
    • gahhon
      By gahhon
      Hi,
      How can I the trigger the another button functions without waiting the previous function to finish execute?
      Any advise?
      I couldn't find any relevant topics via google.
      Thanks a lot.
    • SharpDressedMan
      By SharpDressedMan
      Hi all,
      I need to use ControlMove() on some controls of a hidden GUI window.
      This works properly on a GUI window created with default style, but does not work on a GUI window created with style $WS_OVERLAPPEDWINDOW
      func GUItest($bOverlapped) $m = GUICreate("test", 200, 100, -1, -1, $bOverlapped ? $WS_OVERLAPPEDWINDOW : -1) $g = GUICtrlCreateButton("test", 0, 0) ControlMove($m, "", $g, 30, 30) GUISetState() endfunc GuiTest(false) ; button 'test' properly moved to (30,30) GuiTest(true) ; button 'test' not moved and still sitting at (0,0) Any reason for this unexpected behavior ?
      Any workaround to fix this ?
      Thanks for any help
    • 2Toes
      By 2Toes
      Hi all..
      I'm having slight issue that has be a bit puzzled.
      I have an Input control.. After a certain function runs, it Disables that Input control, and sets it to ReadOnly.
      When running another certain function, it re-Enables that Input control, and sets the style back to Default.
      Which does work, however, when typing into the Input control after re-Enabling it, the text appears as a light gray color, rather than its original black color.
      I'm sure there's a simple solution here.. But what that is, appears to be beyond me.
      Here is a simplified example code:
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 245, 215, 192, 124) Global $disableBTN = GUICtrlCreateButton("Disable", 32, 64, 75, 25) Global $enableBTN = GUICtrlCreateButton("Enable", 128, 64, 75, 25) Global $Input1 = GUICtrlCreateInput("", 32, 120, 169, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $disableBTN disable() Case $enableBTN enable() EndSwitch WEnd Func disable() GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetStyle($Input1, $ES_READONLY) EndFunc Func enable() GUICtrlSetState($Input1, $GUI_ENABLE) GUICtrlSetStyle($Input1, $GUI_SS_DEFAULT_INPUT) EndFunc  
      Any help would be greatly appreciated
      Thank you in advance!
    • jantograaf
      By jantograaf
      Hi all,
      I'm trying to create a script that runs a JSON-query and then can retrieve some variables out of the returned, decoded object using JSON.au3. I have tried some other examples on this forum, but I'm stuck at one point. My query works perfectly and gets loaded into the variable $data. Then, decoding $data to $object seems to work as well. But then I can't get the date-field out of this JSON-structure with my script.
      The JSON-structure returned looks like this:
      { "content": [ { "id": "451ec583-8f27-4926-82a3-a2d85e57a110", "createdDate": "2018-08-08T08:40:57.449004Z", "updatedDate": "2018-08-08T08:40:57.449004Z", "lastOpenedDate": "2018-08-08T08:40:57.449004Z", "date": "2018-04-26T00:00:00", "description": "X-Ray Exam", "patient": { "id": "f857238a-c75d-4760-b8d1-8f50f8f9bbfa", "createdDate": "2018-08-08T08:40:37.623976Z", "updatedDate": "2018-08-08T08:40:37.623976Z", "lastOpenedDate": "2018-08-08T08:40:37.623976Z", "name": "Fuerstonia", "birthDate": "2014-06-08", "breed": "", "chip": "", "color": "", "damsire": "", "sire": "", "neutered": false, "orthancUuid": "", "sex": "U", "species": "Paard", "ueln": "De 431310762114", "pmsReference": "", "origin": "" }, "type": "study", "accessionNumber": "KME201806960467", "instanceUid": null, "orthancUuid": "", "sent": false, "seriesCount": 0, "modalityType": "RX", "typeAndModality": "study RX", "client": { "id": "be627195-8458-4927-8446-f1ef37b917a4", "createdDate": "2018-08-08T08:40:31.433968Z", "updatedDate": "2018-08-08T08:40:31.433968Z", "lastOpenedDate": "2018-08-08T09:26:49.512298Z", "via": "", "extraInfo": "", "pmsReference": "", "contact": { "id": "406cc555-c491-4c29-b6bb-8d903f0e35a9", "createdDate": "2018-08-08T08:40:31.428968Z", "updatedDate": "2018-08-08T08:40:31.428968Z", "lastName": "Client 1", "firstName": "", "company": "", "email": "", "language": "nl", "phone": "", "address": { "id": "6fc7703c-137a-4e0a-ba96-8c7f38f2044b", "city": "", "country": "", "line": "", "postalCode": "" } } } }, My script looks like this:
      #RequireAdmin #include <json.au3> #include <inet.au3> #include <File.au3> ;Create a handle to a logfile (will be created if it doesnt exist) Global $logfile = FileOpen("C:\VSOL\VSTK\Logs\MigrationFix\MigrationFix.log",9) FileWriteLine($logfile,"Start script") ;Create the URL with the JSON-query $URL = "http://localhost:8080/v0/studies/?seriesCount=1" ;Catch the query output into a variable $data = _INetGetSource($URL) ;Check if there is any data at all in this variable, if not, exit If Not $data Then MsgBox(1,"Error","No answer. Server is probably not running.") Exit EndIf ;For debugging purposes FileWriteLine($logfile,$data) ;Decode the JSON_string into a useable object $object = Json_Decode($data,1000) If @error Then FileWriteLine($logfile,"Error decoding JSON") Exit EndIf Local $i = 0 ;Start a loop to retrieve the study date of each study... While 1 $study_date = json_get($object,'[' & $i & '].date') If @error Then FileWriteLine($logfile,"Study-Date retrieval error") ExitLoop EndIf $i = $i + 1 WEnd ;Close the logfile FileWriteLine($logfile,"Stop script") FileClose($logfile) ;Open the logfile for quick reference ShellExecute("C:\VSOL\VSTK\Logs\MigrationFix\MigrationFix.log") If believe it has something to do with my json_get($object...)-command. Anyone who can point me in the right direction?
      Thanks in advance!
      Kind regards
×