Jump to content

Java UDF


seangriffin
 Share

Recommended Posts

As far as i can see, the JComboBox has a panel as child-item. This panel includes a label for each entry :P Possibly this helps you to add native support without OCR.

Not that simple unfortunately (although I wish it were). I should clarify my post above. I meant to say that applications like jEdit "do" expose their combo box and list box items to the Java Access Bridge. Applications like these have list boxes as parents for combo boxes. My UDF uses the listbox parent to retrieve all the items in the combo box. I think this is the sort of thing you are describing? I've tested the UDF on two other apps like jEdit and it works. The OCR part of the UDF is not used for these apps.

There are other Java apps that are unlike jEdit, in that when the items are retrieved from listboxes, the values are garbled. The values aren't ASCII, which makes me suspect that they are encoded in some way. Interestingly, for these apps, AutoIT's Window Info tool can recognise their controls. I can see now that there are at least two different flavours of Java apps. out there. One that allows the Java Access Bridge to retrieve ASCII values from it's combo boxes / list boxes, and the other returns some kind of encoded value.

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia
Link to comment
Share on other sites

Ah, OK. You are right, there are two types of Java Controls AWT which uses native Windows controls and Swing which draws all in java.

I#M Soory, i don't know how to get the text from it. i tried BinaryToString and StringToBinary, but it didn't work

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

  • 2 weeks later...

Hi seangriffin,

Thanks a lot for this great work. I had started with compiling Java Access Bridge to create something that you have already done, till some one pointed it to this thread. I am at ease now.

Note: If you need any further help in this work then you can let me know.

Link to comment
Share on other sites

Hi seangriffin,

Thanks a lot for this great work. I had started with compiling Java Access Bridge to create something that you have already done, till some one pointed it to this thread. I am at ease now.

Note: If you need any further help in this work then you can let me know.

Thanks toakhilesh,

Yes I was at the point you are now only a few months ago. This has been a big piece of work for me, considering I'm not a developer / programmer by trade, but I had worked alot with Ansi C and some Borland C++ a long time ago. I saw this as an opportunity to brush up on my C skills, and get familiar with Microsoft's Visual C++.

Initailly it took me about a week to install and integrate the Java Access Bridge into Visual C++, and about another week to understand how to write a DLL. Then the rest of the time I've been creating and modifying the functions in the DLL to work with AutoIT.

I'm noticing that not all Java apps are the same. This makes things hard. Just when I think I have a control properly automated, along comes another Java app. that's a little different. So the UDF is contantly changing and there will be cases where my functions won't work.

The best thing you can do for me right now is to try it with a Java app. of your own. I think you'll find a few things that need to be added or fixed in the UDF. If I get overwhelmed with the workload then please get involved. The size of the "AutoITJavaAccess.dll" project is too big to post and maintain in these forums (I think the full project is over 80Mb in filesize), which is why I haven't shared the source code so far. Would be good if I could make the DLL some kind of open source project that others can contribute to or comment on. I have no experience with managing an open source project though. Is this something I could setup in SourceForge?

Edited by seangriffin

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia
Link to comment
Share on other sites

This is really an excellent work, especially since you are not into mainstream coding. After going thru the code and the samples that you have given I have the following comments:

1. The Accessibility Feature works better with applications compiled with newer version of JDK. The included Piface looks like a very old application and probably not good example for automation. Other applications I tested made using newer version of JDK gave better results.

I will be trying to automate my application (JDK 1.5) that works as a Applet as well as standalone Java Application. Will comment as I proceed automating it.

2. As the AutoITJavaAccess.dll is created using Visual Studio 9, it requires Microsoft Visual C++ 2008 Redistributable. Also it may not as it is work with XP machines on which .net is not installed. VC6 output is desirable that will do away with such requirements, but this is not at all critical.

3. I think we should have similar functions to the Windows Control functions provided by AutoIt. This will lessen the learning curve, and it will be easier to code a script generators someday. Some thing like:

JControlClick()

JControlCommand()

JControlDisable()

...

The size of the "AutoITJavaAccess.dll" project is too big to post and maintain in these forums (I think the full project is over 80Mb in filesize), which is why I haven't shared the source code so far.

4. I don't think that should be the case. VC generates some temporary files that can be ignored safely. Like:

- Debug Folder

- Release Folder

- .ncb file

Once these files are removed then the rest of the project size should become quiet small.

Would be good if I could make the DLL some kind of open source project that others can contribute to or comment on. I have no experience with managing an open source project though. Is this something I could setup in SourceForge?

5. Yes. SourceForge will let you host the project, and so will Google Code. I have only worked with Google Code and it is quiet easy to setup. Only deciding factor is the correct License which can be associated with these projects.

Link to comment
Share on other sites

  • 4 weeks later...

When trying to run the _JavaObjValueGet.au3 I get the following error

>Running AU3Check (1.54.14.0)  from:C:\Program Files\AutoIt3
C:\Program Files\AutoIt3\Include\Java.au3(871,41) : WARNING: $javaferret_obj_role: possibly used before declaration.
            if StringCompare($javaferret_obj_role,
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\Java.au3(871,41) : ERROR: $javaferret_obj_role: undeclared global variable.
            if StringCompare($javaferret_obj_role,
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\My Documents\AutoIT Scripts\JavaTests\_JavaObjValueGet.au3 - 1 error(s), 1 warning(s)
!>09:54:08 AU3Check ended.rc:2

I followed the steps for install I think and went back to double check everything. Any suggestions of what to look at next?

Javaferret.exe seems to work great with the piface.jar program.

Edited by JohnW
Link to comment
Share on other sites

  • 2 weeks later...

I've installed everything and have tried running the examples as well. It's an optional parameter in the function call. You can just click "Continue Anyway" and run the script. An explanation from the script:

; Parameters ....:    $autoit_cntl_id                   - Optional: The AutoIT control ID of the object to get the value of.
;                                                                        If this is not used, then $javaferret_obj_name and/or $javaferret_obj_role must be set.
;                            $javaferret_obj_name        - Optional: The JavaFerret name of the object to get the value of.
;                                                                        If this is not used, then $instance_num must be set.
;                            $javaferret_obj_role           - Optional: The JavaFerret role of the object to get the value of.
;                                                                        If this is not used, then $autoit_cntl_id must be set.oÝ÷ Øz0z÷«#f«â÷Þ­éí¦ºééÈ®éÉjön5Zçz֮ܯhæãU©nzÁµ«·¢²Z½£V¥¹äµ«·#fëmxZ)Ý£®º+ªê-Z)Ý£jyèµø§wBÓÝ®+jgâë4÷k^²Ç«iËt÷k^²Ç«iË^ÅíýNjö»wâè§r[zÄ޲ǫiËZ»vî¶Ø^­éèq©e¶­zË­§-{¬£^­è¬Z)Ý£ zÛbaj×ë¢`v+b¢v¥(­ßÛ¦«z{eÊz-iDzȧØ^Më,z¶µ«·~)^jÖ¥·j붭{lzÛضÇhmv§ÊØb'ÊÞz0­ßÛ ¢)à¢|"¶ajÚ®¢×§jg

I followed the steps for install I think and went back to double check everything. Any suggestions of what to look at next?

Javaferret.exe seems to work great with the piface.jar program.

Link to comment
Share on other sites

  • 3 weeks later...

@jlundqui : tesseract is a free OCR which has to be installed for the tesseract UDF to work.

see : http://www.autoitscript.com/forum/index.ph...mp;hl=tesseract

@seangriffin : great work !

I am trying to use this for automating an Oracle forms webbased application (running on an Oracle application server)

The application runs on the Sun java plugin version 6U13.

The Java Ferret works fine.

Your _JavaObjPropertyGet UDF also does the job.

But there is a problem when I try to push buttons with the _JavaObjSelect UDF.

This syntax does not seem to have any effect on the button that I want to be pushed in the application:

$java_obj1 = _JavaObjSelect("[TEXT:Verlaten]", "", "push button")

This syntax "crashes" the application:

$java_obj1 =_JavaObjSelect("", "Verlaten", "push button")

I get an FRM-92100 in the form and the connection with the application server is lost.

The java error in the Sun java console looks like this :

java.lang.SecurityException: this KeyboardFocusManager is not installed in the current thread's context

at java.awt.KeyboardFocusManager.getGlobalFocusOwner(Unknown Source)

at java.awt.KeyboardFocusManager.processSynchronousLightweightTransfer(Unknown Source)

at sun.awt.windows.WComponentPeer.processSynchronousLightweightTransfer(Native Method)

at sun.awt.windows.WComponentPeer.requestFocus(Unknown Source)

...

Any suggestion is welcome.

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper
Link to comment
Share on other sites

  • 2 months later...

I am wondering if there is any way to make this UDF act more like JavaMonkey than JavaFerret. I have already asked this in a different thread, but it seems to not get a lot of play lately; so I thought I would come right to the source (thread link).

The reason I ask is that I am trying to retrieve a list that is bigger than the viewing window and place into an Excel CSV file. I have rigged up a shaky Pixel color reference Do... Until that notes if there is a scroll bar and goes until it can no longer click to go any lower. Then it reads the info to an array to separate the uniques from the repeats, pastes those into the CSV and saves for another associate to review.

I am hoping that there will be a way to grab ALL the info from a control (i.e. - How the info is listed in JavaMonkey) someday soon as this would really help me out.

Code example:

; =======================================================================================================================
; ------ Select the License tab -----------------------------------------------------------------------------------------
WinWait("AGENT")
$Agent = WinGetHandle("AGENT")
_JavaAttachAndWait($Agent)
WinActivate($Agent)
WinSetState($Agent, "", @SW_MAXIMIZE)

Do
    Mouseclick("left", 1266, 81)
    $sTabState1 = _JavaObjPropertyGet("", "License", "page tab", "", "States")
    
Until $sTabState1 = "enabled,focusable,visible,showing,selectable,selected"

$sTabState2 = _JavaObjPropertyGet("", "License List", "page tab", "", "States")

; =======================================================================================================================
; ------ Get the License info -------------------------------------------------------------------------------------------
For $i1 = 1 To 50

    $sLabel1 = _JavaObjPropertyGet("", "", "label", $i1, "Name")
    $sLabel2 = _JavaObjPropertyGet("", "", "label", $i1, "Role")

    _ExcelWriteCell($oExcel, $sLabel1, $i1, 1)

    If $sLabel2 <> "label" Then ExitLoop

Next

WinActivate($Agent)
$iPixel = Hex(PixelGetColor(1206, 927), 6)

; Sets $iPixelY to 167
$iPixelY = 167

If $iPixel <> "FFFFFF" Then
    
    Do
        Do
            $iPixelHex = Hex(PixelGetColor(1206, $iPixelY), 6)
            $iPixelY = $iPixelY+9
        Until $iPixelHex = "CCCCCC"

        $iPixelY = $iPixelY-9

        If $iPixelY < 927 Then 
            Mouseclick("left", 1206, $iPixelY)
            Sleep(1000)
        Else
            Mouseclick("left", 1206, 927)
            Sleep(1000)
        EndIf
        
        For $i2 = 1 To 50

            $sLabel1 = _JavaObjPropertyGet("", "", "label", $i2, "Name")
            $sLabel2 = _JavaObjPropertyGet("", "", "label", $i2, "Role")

            _ExcelWriteCell($oExcel, $sLabel1, $i2+$i1, 1)

            If $sLabel2 <> "label" Then ExitLoop

        Next
    
    Until Hex(PixelGetColor(1206, 928), 6) = "666699"

EndIf

; =======================================================================================================================


; Saves and closes the Excel spreadsheet
_ExcelBookSaveAs($oExcel, @DesktopDir & "\JAVARead", "csv", 0, 1)
_ExcelBookClose($oExcel, 1, 0)


Exit
Link to comment
Share on other sites

  • 1 month later...

This is AWESOME.

I've been looking and looking for a java GUI automation solution for quite some time!

I've only just started playing with it, but so far it works a lot better then anything else i had tried.

keep up the good work

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I have a question concerning the _JavaObjSelect function:

I try to set a value and then select this value in Piface application.

I use

$java_obj1 = _JavaObjValueSet("[CLASS:Edit; INSTANCE:2]", "", "", 'hello')
$java_obj1 = _JavaObjSelect("[CLASS:Edit; INSTANCE:2]", "", "")

I can see that 'pi' parameter is changing to 'hello'. But there is no focus on this parameter.

Does anyone can help me ?

Thanks in advance.

Edit:

Same thing with:

$java_obj1 = _JavaObjSelect("", "pi", "text")
Edited by chMan
Link to comment
Share on other sites

  • 2 weeks later...

I noticed the Tesseract link is no longer valid, so you may want to update it to the current url:

http://www.autoitscript.com/forum/index.php?showtopic=89542&hl=tesseract&st=0

Thanks for that! :)

Updated the first post with this link.

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia
Link to comment
Share on other sites

I've installed everything and have tried running the examples as well. It's an optional parameter in the function call. You can just click "Continue Anyway" and run the script. An explanation from the script:

; Parameters ....:    $autoit_cntl_id                   - Optional: The AutoIT control ID of the object to get the value of.
;                                                                        If this is not used, then $javaferret_obj_name and/or $javaferret_obj_role must be set.
;                            $javaferret_obj_name        - Optional: The JavaFerret name of the object to get the value of.
;                                                                        If this is not used, then $instance_num must be set.
;                            $javaferret_obj_role           - Optional: The JavaFerret role of the object to get the value of.
;                                                                        If this is not used, then $autoit_cntl_id must be set.oÝ÷ Øz0z÷«#f«â÷Þ­éí¦ºééÈ®éÉjön5Zçz֮ܯhæãU©nzÁµ«·¢²Z½£V¥¹äµ«·#fëmxZ)Ý£®º+ªê-Z)Ý£jyèµø§wBÓÝ®+jgâë4÷k^²Ç«iËt÷k^²Ç«iË^ÅíýNjö»wâè§r[zÄ޲ǫiËZ»vî¶Ø^­éèq©e¶­zË­§-{¬£^­è¬Z)Ý£ zÛbaj×ë¢`v+b¢v¥(­ßÛ¦«z{eÊz-iDzȧØ^Më,z¶µ«·~)^jÖ¥·j붭{lzÛضÇhmv§ÊØb'ÊÞz0­ßÛ ¢)à¢|"¶ajÚ®¢×§jg

I followed the steps for install I think and went back to double check everything. Any suggestions of what to look at next?

Javaferret.exe seems to work great with the piface.jar program.

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia
Link to comment
Share on other sites

@jlundqui : tesseract is a free OCR which has to be installed for the tesseract UDF to work.

see : http://www.autoitscript.com/forum/index.ph...mp;hl=tesseract

@seangriffin : great work !

I am trying to use this for automating an Oracle forms webbased application (running on an Oracle application server)

The application runs on the Sun java plugin version 6U13.

The Java Ferret works fine.

Your _JavaObjPropertyGet UDF also does the job.

But there is a problem when I try to push buttons with the _JavaObjSelect UDF.

This syntax does not seem to have any effect on the button that I want to be pushed in the application:

$java_obj1 = _JavaObjSelect("[TEXT:Verlaten]", "", "push button")

This syntax "crashes" the application:

$java_obj1 =_JavaObjSelect("", "Verlaten", "push button")

I get an FRM-92100 in the form and the connection with the application server is lost.

The java error in the Sun java console looks like this :

java.lang.SecurityException: this KeyboardFocusManager is not installed in the current thread's context

at java.awt.KeyboardFocusManager.getGlobalFocusOwner(Unknown Source)

at java.awt.KeyboardFocusManager.processSynchronousLightweightTransfer(Unknown Source)

at sun.awt.windows.WComponentPeer.processSynchronousLightweightTransfer(Native Method)

at sun.awt.windows.WComponentPeer.requestFocus(Unknown Source)

...

Any suggestion is welcome.

Hi Gyzmok.

I'm noticing more and more these days that people are trying to automate java based Oracle software. I spent a number of weeks working with someone, back and forth through private messages, to get the UDF to work with an application in Oracle Developer Forms using Oracle Application Server Forms Services. It wasn't easy. I had to change the behaviour of the AutoITJavaAccess.dll considerably, to use the Java Access Bridge in new "wierd and wonderful ways" to make it talk properly with the application. We got it working in the end, and really helped in maturing the UDF.

Recently I had attempted to automate an Oracle Applications test environment I found online, but had no luck in getting the Java Ferret, and therefore the UDF, to work with it. See this topic.

So in summary, Oracle java based apps are really putting the UDF through it's paces. I'm not sure how to solve your problem unless I can get my hands on an example of your application and debug the AutoITJavaAccess.dll against it.

Edited by seangriffin

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia
Link to comment
Share on other sites

I am wondering if there is any way to make this UDF act more like JavaMonkey than JavaFerret. I have already asked this in a different thread, but it seems to not get a lot of play lately; so I thought I would come right to the source (thread link).

The reason I ask is that I am trying to retrieve a list that is bigger than the viewing window and place into an Excel CSV file. I have rigged up a shaky Pixel color reference Do... Until that notes if there is a scroll bar and goes until it can no longer click to go any lower. Then it reads the info to an array to separate the uniques from the repeats, pastes those into the CSV and saves for another associate to review.

I am hoping that there will be a way to grab ALL the info from a control (i.e. - How the info is listed in JavaMonkey) someday soon as this would really help me out.

Code example:

; =======================================================================================================================
; ------ Select the License tab -----------------------------------------------------------------------------------------
WinWait("AGENT")
$Agent = WinGetHandle("AGENT")
_JavaAttachAndWait($Agent)
WinActivate($Agent)
WinSetState($Agent, "", @SW_MAXIMIZE)

Do
    Mouseclick("left", 1266, 81)
    $sTabState1 = _JavaObjPropertyGet("", "License", "page tab", "", "States")
    
Until $sTabState1 = "enabled,focusable,visible,showing,selectable,selected"

$sTabState2 = _JavaObjPropertyGet("", "License List", "page tab", "", "States")

; =======================================================================================================================
; ------ Get the License info -------------------------------------------------------------------------------------------
For $i1 = 1 To 50

    $sLabel1 = _JavaObjPropertyGet("", "", "label", $i1, "Name")
    $sLabel2 = _JavaObjPropertyGet("", "", "label", $i1, "Role")

    _ExcelWriteCell($oExcel, $sLabel1, $i1, 1)

    If $sLabel2 <> "label" Then ExitLoop

Next

WinActivate($Agent)
$iPixel = Hex(PixelGetColor(1206, 927), 6)

; Sets $iPixelY to 167
$iPixelY = 167

If $iPixel <> "FFFFFF" Then
    
    Do
        Do
            $iPixelHex = Hex(PixelGetColor(1206, $iPixelY), 6)
            $iPixelY = $iPixelY+9
        Until $iPixelHex = "CCCCCC"

        $iPixelY = $iPixelY-9

        If $iPixelY < 927 Then 
            Mouseclick("left", 1206, $iPixelY)
            Sleep(1000)
        Else
            Mouseclick("left", 1206, 927)
            Sleep(1000)
        EndIf
        
        For $i2 = 1 To 50

            $sLabel1 = _JavaObjPropertyGet("", "", "label", $i2, "Name")
            $sLabel2 = _JavaObjPropertyGet("", "", "label", $i2, "Role")

            _ExcelWriteCell($oExcel, $sLabel1, $i2+$i1, 1)

            If $sLabel2 <> "label" Then ExitLoop

        Next
    
    Until Hex(PixelGetColor(1206, 928), 6) = "666699"

EndIf

; =======================================================================================================================


; Saves and closes the Excel spreadsheet
_ExcelBookSaveAs($oExcel, @DesktopDir & "\JAVARead", "csv", 0, 1)
_ExcelBookClose($oExcel, 1, 0)


Exit

This reply has probably come too late :) . Sorry dm83737. I've been so busy lately.

Can you clarify what you were after, or if you still need this function? Sounds like you are after a tree output of all the descendant objects of a given Java object in the JVM? Probably a good function to have actually. Not sure how it helps you, but I guess a function to output the tree of Java objects would be useful to someone?

Edited by seangriffin

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia
Link to comment
Share on other sites

  • 2 weeks later...

Thanks so much Reinhard. Glad to see the issue is consistent across all computers except the computer I'm developing on. I ran "regsvr32 AutoITJavaAccess.dll" on another computer and got an error message that seems to indicate that the file is not correctly installed.

"AutoITJavaAccess.dll" is my first attempt at creating a DLL using MS Visual C++. I can build it and use it fine on my own computer, but after distributing it to other computers it doesn't work. It seems I have to build a (re)distributable package or installer of sorts, in order to distribute this DLL to other computers.

I'm going through a learning curve with Visual C++. You'll all have to bare with me until I sort this out. I think I'm nearly there though. Maybe in the next few days. I'm also having Windows Message Queue issues in my code, but again it's just because I'm new to C++ programming in Windows.

Any one can help me to Automate a Java application .I installed the JAVA UDF ,through Java ferret identifying controls in Java window but the code is not working.

winActivate("Title")

_JavaAttachAndWait("Tilte")

$java_obj2 = _JavaObjSelect("", "File", "menu")

Any one can help me ?

Link to comment
Share on other sites

This UDF provides automation support for Java applications.

This UDF currently automates standalone applications and browser-based applets, developed in either Swing or the Abstract Window Toolkit (AWT).

REQUIREMENTS:

  • AutoIt3 3.2 or higher
  • Java Runtime Environment (JRE) 1.4 or above
  • Java Access Bridge for the Microsoft Windows Operating System
  • Microsoft Visual C++ 2008 Redistributable
  • AutoIT for Java Access dynamically linked library (DLL)
  • Tesseract UDF 0.6
  • Manual check and update of the Java Access Bridge
INSTALLATION:

To install the latest Java Runtime Environment (JRE):

  • Open the web page http://java.com/en/download/manual.jsp.
  • Click Windows XP/Vista/2000/2003 Offline.
  • Save the file to your computer and run it (ie. jre-6u11-windows-i586-p-s.exe).
  • Follow the installation instructions.
  • Restart your computer when prompted.
To install the Java Access Bridge for the Microsoft Windows Operating System:

  • Open the web page Java Access Bridge.
  • Click Download Java Access Bridge 2.0.1.
  • Click I agree to the Software License Agreement.
  • Click Continue.
  • Click accessbridge-2_0_1.exe.
  • Save the file to a location on your computer.
  • Run the file accessbridge-2_0_1.exe from your computer.
  • Follow the installation instructions.
  • Restart your computer when prompted.
To install the Microsoft Visual C++ 2008 Redistributable:

  • Open the web page http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en.
  • Click Download.
  • Save the file to a location on your computer.
  • Run the file vcredist_x86.exe from your computer.
  • Follow the installation instructions.
To install the AutoIT for Java Access dynamically linked library (DLL):

  • Right-click on the link AutoITJavaAccess.dll below.
  • Save the file to your Windows System32 folder (ie. C:\WINDOWS\system32).
To install the Tesseract UDF 0.6:

To manually check and update the Java Access Bridge:

Note:- This step should be performed in addition to the install of the Java Access Bridge above.

  • Using Windows Explorer, go to your Java folder C:\Program Files\Java.
  • Open the first subfolder (ie. j2re1.4.2_19).
  • Go to the subfolder lib\ext.
  • If the files access-bridge.jar and jaccess.jar already exist then go to step 9 below.
  • Copy the file access-bridge.jar to this subfolder (ie. C:\Program Files\Java\jre1.4.2_19\lib\ext).
  • If the subfolder in step 2 above starts with j2re1.2 or jre1.2, then copy the file jaccess-1_2.jar to this subfolder (ie. C:\Program Files\Java\jre1.4.2_19\lib\ext).
  • If the subfolder in step 2 above starts with j2re1.3 or jre1.3, then copy the file jaccess-1_3.jar to this subfolder (ie. C:\Program Files\Java\jre1.4.2_19\lib\ext).
  • If the subfolder in step 2 above starts with j2re1.4 or jre1.4, then copy the file jaccess-1_4.jar to this subfolder (ie. C:\Program Files\Java\jre1.4.2_19\lib\ext).
  • Repeat steps 3 to 8 for every subfolder within the Java folder.

To confirm that the installation process was successful:

  • Using Windows Explorer, go to C:\Program Files\Java Access Bridge and double-click JavaFerret.exe.
  • In the Java Ferret window, select the menu item JavaEvents -> Track Mouse Events.
  • Drag your mouse over any Java application, and the Java Ferret window should dynamically update with information about the Java objects as you drag your mouse over them.
LIST OF FUNCTIONS:

DEMONSTRATION:

<Under Construction>

EXAMPLES:

_JavaObjValueGet.au3

_JavaObjValueSet.au3_JavaObjValueSelect.au3

_JavaObjValuesGet.au3_JavaObjPropertyGet.au3

DOWNLOAD:

Latest Version - v0.7 (17/03/09)

AutoITJavaAccess.dllJava.au3

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...