Jump to content

Autoit reading text from Java window - (Moved)

Recommended Posts



I'm trying to get a text value from simple Java window (even from some text demo from oracle).

First I was using Java UDF from this forum, but it's not working, "_JavaObjValuesGet" gives me nothing.

Then i have found this:



is there a person who could tell me how to implement into this script some simple text reading, From JAB api i.e. 


BOOL GetAccessibleTextInfo(long 199730, AccessibleText at, AccessibleTextInfo *textInfo, jint 1921, jint 1);


Share this post

Link to post
Share on other sites

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:


General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.

Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites


JAB API documentation:


BOOL GetAccessibleTextItems(long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index);

struct AccessibleTextItemsInfo {
 wchar_t letter;
 wchar_t word[SHORT_STRING_SIZE];
 wchar_t sentence[MAX_STRING_SIZE];


I'm recreating steps from original script:

const $TypeStructAccessibleTextItemsInfo="WCHAR letter[32];WCHAR word[256];WCHAR sentence[1024]"
Local $AccessibleTextItemsInfo=DllStructCreate($TypeStructAccessibleTextItemsInfo)

my problem starts here:

$result2 = dllcall($bridgeDLL, "BOOL:cdecl","GetAccessibleTextItemsInfo","long", $vmId, ??WHAT INSERT HERE?? )

i have no idea what i must insert in the above.


Share this post

Link to post
Share on other sites

This script was crashing, i changed the path to DLL to  "C:\Windows\System32\WindowsAccessBridge-64.dll". Now it works when I run it from AutoIt3_x64.exe.

I have made "my script" inside jabsimplespy to look like this.

const $TypeStructAccessibleTextItemsInfo="WCHAR letter[256];WCHAR word[256];WCHAR sentence[1024]"
Local $AccessibleTextItemsInfo=DllStructCreate($TypeStructAccessibleTextItemsInfo)

local $at
local $indextext
$result2 = dllcall($hAccessBridgeDll, "BOOL:cdecl","GetAccessibleTextItemsInfo","long", $vmId, "long",$at ,"struct*" ,$AccessibleTextItemsInfo, "long", $indextext  )
$AccessibleTextItemsInfo =$result2[1]

Now I'm getting "subscript used on non-accessible variable" on $result2[0], $result2[1], $result2[2]. So I'm thinking.. dllcall is not working properly and thats why $result2 gives nothing. I'm still in the same spot I was earlier ;(



My normal result is like this:

Mouse position is retrieved 2729-774
  JAVA window found <> Java Window Title= Handle=0x00000000000116D6     res: 1
Result getAccessibleContextFromHWND is <> ubound: 4
  We have a VMid 132182 ac 1430183872
Call version info: PASSED VMID found : 132182
  VMVersion: <1.8.0_91>
  bridgeJavaClassVersion: <1.8.0_91>
  bridgeJavaDLLVersion: <1.8.0_91>
  bridgeWinDLLVersion: <1.8.0_91>
 *** getAccessibleContextAT result is <1430183824>
 *** getAccessibleContextAT result is <1430183824>

focusable,visible,showing,editable,single line
focusable,visible,showing,editable,single line
End of getAcceccibleContextAt info


Edited by dorel
added info from jabsimplespy

Share this post

Link to post
Share on other sites

Maybe OCR, Tesseract for example.


Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples


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