Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/30/2019 in all areas

  1. Here is the latest assembly engine from Tomasz Grysztar, flat assembler g as a dll which I compiled using original fasm engine. He doesn't have it compiled in the download package but it was as easy as compiling a exe in autoit if you ever have to do it yourself. Just open up the file in the fasm editor and press F5. You can read about what makes fasmg different from the original fasm HERE if you want . The minimum you should understand is that this engine is bare bones by itself not capable of very much. The macro engine is the major difference and it uses macros for basically everything now including implementing the x86 instructions and formats. All of these macros are located within the include folder and you should keep that in its original form. When I first got the dll compiled I couldn't get it to generate code in flat binary format. It was working but size of output was over 300 bytes no matter what the assembly code and could just tell it was outputting a different format than binary. Eventually I figured out that within the primary "include\win32ax.inc"', it executes a macro "format PE GUI 4.0" if x86 has not been defined. I underlined macro there because at first I (wasted shit loads of time because I) didn't realize it was a macro (adding a bunch of other includes) since in version 1 the statement "format binary" was a default if not specified and specifically means add nothing extra to the code. So long story short, the part that I was missing is including the cpu type and extensions from include\cpu folder. By default I add x64 type and SSE4 ext includes. Note that the x64 here is not about what mode we are running in, this is for what instructions your cpu supports. if you are running on some really old hardware that may need to be adjusted or if your on to more advanced instructions like the avx extensions, you may have to add those includes to your source. Differences from previous dll function I like the error reporting much better in this one. With the last one we had a ton error codes and a variable return structure depending on what kind of error it had. I even had an example showing you what kind of an error would give you correct line numbers vs wouldn't. With this one the stdout is passed to the dll function and it simply prints the line/details it had a problem with to the console. The return value is the number of errors counted. It also handles its own memory needs automatically now . If the output region is not big enough it will virtualalloc a new one and virtualfree the previous. Differences in Code Earlier this year I showed some examples of how to use the macros to make writing assembly a little more familiar. Almost all the same functionality exists here but there are a couple syntax sugar items gone and slight change in other areas. Whats gone is FIX and PTR. Both syntax sugar that dont really matter. A couple changes to structures as well but these are for the better. One is unnamed elements are allowed now, but if it does not have a name, you are not allowed to initialize those elements during creation because they can only be intialized via syntax name:value . Previously when you initialized the elements, you would do by specifying values in a comma seperated list using the specific order like value1,value2,etc, but this had a problem because it expected commas even when the elements were just padding for alignment so this works out better having to specify the name and no need for _FasmFixInit function. "<" and ">" are not longer used in the initializes ether. OLD: $sTag = 'byte x;short y;char sNote[13];long odd[5];word w;dword p;char ext[3];word finish' _(_FasmAu3StructDef('AU3TEST', $sTag));convert and add definition to source _(' tTest AU3TEST ' & _FasmFixInit('1,222,<"AutoItFASM",0>,<41,43,43,44,45>,6,7,"au3",12345', $sTag));create and initalize New: $sTag = 'byte x;short y;char sNote[13];long odd[5];word w;dword p;char ext[3];word finish' _(_fasmg_Au3StructDef('AU3TEST', $sTag)) ;convert and add definition to source _(' tTest AU3TEST x:11,y:22,sNote:"AutoItFASM",odd:41,odd+4:42,odd+8:43,w:6,p:7,ext:"au3",finish:12345');create and initalize Extra Includes I created a includeEx folder for the extra macros I wrote/found on the forums. Most of them are written by Thomaz so they may eventually end up in the standard library. Edit: Theres only the one include folder now. All the default includes are in thier own folder within that folder and all the custom ones are top level. Align.inc, Nop.inc, Listing.inc The Align and Nop macros work together to align the next statement to whatever boundary you specified and it uses multibyte nop codes to fill in the space. Filling the space with nop is the default but you can also specify a fill value if you want. Align.assume is another macro part of align.inc that can be used to set tell the engine that a certain starting point is assumed to be at a certain boundary alignment and it will do its align calculations based on that value. Listing is a macro great for seeing where and what opcodes are getting generated from each line of assembly code. Below is an example of the source and output you would see printed to the console during the assembly. I picked this slightly longer example because it best shows use of align, nop, and then the use of listing to verify the align/nop code. Nop codes are instructions that do nothing and one use of them is to insert nop's as space fillers when you want a certian portion of your code to land on a specific boundary offset. I dont know all the best practices here with that (if you do please post!) but its a type of optimization for the cpu. Because of its nature of doing nothing, I cant just run the code and confirm its correct because it didnt crash. I need to look at what opcodes the actual align statements made and listing made that easy. source example: _('procf _main stdcall, pAdd') _(' mov eax, [pAdd]') _(' mov dword[eax], _crc32') _(' mov dword[eax+4], _strlen') _(' mov dword[eax+8], _strcmp') _(' mov dword[eax+12], _strstr') _(' ret') _('endp') _('EQUAL_ORDERED = 1100b') _('EQUAL_ANY = 0000b') _('EQUAL_EACH = 1000b') _('RANGES = 0100b') _('NEGATIVE_POLARITY = 010000b') _('BYTE_MASK = 1000000b') _('align 8') _('proc _crc32 uses ebx ecx esi, pStr') _(' mov esi, [pStr]') _(' xor ebx, ebx') _(' not ebx') _(' stdcall _strlen, esi') _(' .while eax >= 4') _(' crc32 ebx, dword[esi]') _(' add esi, 4') _(' sub eax, 4') _(' .endw') _(' .while eax') _(' crc32 ebx, byte[esi]') _(' inc esi') _(' dec eax') _(' .endw') _(' not ebx') _(' mov eax, ebx') _(' ret') _('endp') _('align 8, 0xCC') ; fill with 0xCC instead of NOP _('proc _strlen uses ecx edx, pStr') _(' mov ecx, [pStr]') _(' mov edx, ecx') _(' mov eax, -16') _(' pxor xmm0, xmm0') _(' .repeat') _(' add eax, 16') _(' pcmpistri xmm0, dqword[edx + eax], 1000b') ;EQUAL_EACH') _(' .until ZERO?') ; repeat loop until Zero flag (ZF) is set _(' add eax, ecx') ; add remainder _(' ret') _('endp') _('align 8') _('proc _strcmp uses ebx ecx edx, pStr1, pStr2') ; ecx = string1, edx = string2' _(' mov ecx, [pStr1]') ; ecx = start address of str1 _(' mov edx, [pStr2]') ; edx = start address of str2 _(' mov eax, ecx') ; eax = start address of str1 _(' sub eax, edx') ; eax = ecx - edx | eax = start address of str1 - start address of str2 _(' sub edx, 16') _(' mov ebx, -16') _(' STRCMP_LOOP:') _(' add ebx, 16') _(' add edx, 16') _(' movdqu xmm0, dqword[edx]') _(' pcmpistri xmm0, dqword[edx + eax], EQUAL_EACH + NEGATIVE_POLARITY') ; EQUAL_EACH + NEGATIVE_POLARITY ; find the first *different* bytes, hence negative polarity' _(' ja STRCMP_LOOP') ;a CF or ZF = 0 above _(' jc STRCMP_DIFF') ;c cf=1 carry _(' xor eax, eax') ; the strings are equal _(' ret') _(' STRCMP_DIFF:') _(' mov eax, ebx') _(' add eax, ecx') _(' ret') _('endp') _('align 8') _('proc _strstr uses ecx edx edi esi, sStrToSearch, sStrToFind') _(' mov ecx, [sStrToSearch]') _(' mov edx, [sStrToFind]') _(' pxor xmm2, xmm2') _(' movdqu xmm2, dqword[edx]') ; load the first 16 bytes of neddle') _(' pxor xmm3, xmm3') _(' lea eax, [ecx - 16]') _(' STRSTR_MAIN_LOOP:') ; find the first possible match of 16-byte fragment in haystack') _(' add eax, 16') _(' pcmpistri xmm2, dqword[eax], EQUAL_ORDERED') _(' ja STRSTR_MAIN_LOOP') _(' jnc STRSTR_NOT_FOUND') _(' add eax, ecx ') ; save the possible match start') _(' mov edi, edx') _(' mov esi, eax') _(' sub edi, esi') _(' sub esi, 16') _(' @@:') ; compare the strings _(' add esi, 16') _(' movdqu xmm1, dqword[esi + edi]') _(' pcmpistrm xmm3, xmm1, EQUAL_EACH + NEGATIVE_POLARITY + BYTE_MASK') ; mask out invalid bytes in the haystack _(' movdqu xmm4, dqword[esi]') _(' pand xmm4, xmm0') _(' pcmpistri xmm1, xmm4, EQUAL_EACH + NEGATIVE_POLARITY') _(' ja @b') _(' jnc STRSTR_FOUND') _(' sub eax, 15') ;continue searching from the next byte _(' jmp STRSTR_MAIN_LOOP') _(' STRSTR_NOT_FOUND:') _(' xor eax, eax') _(' ret') _(' STRSTR_FOUND:') _(' sub eax, [sStrToSearch]') _(' inc eax') _(' ret') _('endp') Listing Output: 00000000: use32 00000000: 55 89 E5 procf _main stdcall, pAdd 00000003: 8B 45 08 mov eax, [pAdd] 00000006: C7 00 28 00 00 00 mov dword[eax], _crc32 0000000C: C7 40 04 68 00 00 00 mov dword[eax+4], _strlen 00000013: C7 40 08 90 00 00 00 mov dword[eax+8], _strcmp 0000001A: C7 40 0C D8 00 00 00 mov dword[eax+12], _strstr 00000021: C9 C2 04 00 ret 00000025: localbytes = current 00000025: purge ret?,locals?,endl?,proclocal? 00000025: end namespace 00000025: purge endp? 00000025: EQUAL_ORDERED = 1100b 00000025: EQUAL_ANY = 0000b 00000025: EQUAL_EACH = 1000b 00000025: RANGES = 0100b 00000025: NEGATIVE_POLARITY = 010000b 00000025: BYTE_MASK = 1000000b 00000025: 0F 1F 00 align 8 00000028: 55 89 E5 53 51 56 proc _crc32 uses ebx ecx esi, pStr 0000002E: 8B 75 08 mov esi, [pStr] 00000031: 31 DB xor ebx, ebx 00000033: F7 D3 not ebx 00000035: 56 E8 2D 00 00 00 stdcall _strlen, esi 0000003B: 83 F8 04 72 0D .while eax >= 4 00000040: F2 0F 38 F1 1E crc32 ebx, dword[esi] 00000045: 83 C6 04 add esi, 4 00000048: 83 E8 04 sub eax, 4 0000004B: EB EE .endw 0000004D: 85 C0 74 09 .while eax 00000051: F2 0F 38 F0 1E crc32 ebx, byte[esi] 00000056: 46 inc esi 00000057: 48 dec eax 00000058: EB F3 .endw 0000005A: F7 D3 not ebx 0000005C: 89 D8 mov eax, ebx 0000005E: 5E 59 5B C9 C2 04 00 ret 00000065: localbytes = current 00000065: purge ret?,locals?,endl?,proclocal? 00000065: end namespace 00000065: purge endp? 00000065: CC CC CC align 8, 0xCC 00000068: 55 89 E5 51 52 proc _strlen uses ecx edx, pStr 0000006D: 8B 4D 08 mov ecx, [pStr] 00000070: 89 CA mov edx, ecx 00000072: B8 F0 FF FF FF mov eax, -16 00000077: 66 0F EF C0 pxor xmm0, xmm0 0000007B: .repeat 0000007B: 83 C0 10 add eax, 16 0000007E: 66 0F 3A 63 04 02 08 pcmpistri xmm0, dqword[edx + eax], 1000b 00000085: 75 F4 .until ZERO? 00000087: 01 C8 add eax, ecx 00000089: 5A 59 C9 C2 04 00 ret 0000008F: localbytes = current 0000008F: purge ret?,locals?,endl?,proclocal? 0000008F: end namespace 0000008F: purge endp? 0000008F: 90 align 8 00000090: 55 89 E5 53 51 52 proc _strcmp uses ebx ecx edx, pStr1, pStr2 00000096: 8B 4D 08 mov ecx, [pStr1] 00000099: 8B 55 0C mov edx, [pStr2] 0000009C: 89 C8 mov eax, ecx 0000009E: 29 D0 sub eax, edx 000000A0: 83 EA 10 sub edx, 16 000000A3: BB F0 FF FF FF mov ebx, -16 000000A8: STRCMP_LOOP: 000000A8: 83 C3 10 add ebx, 16 000000AB: 83 C2 10 add edx, 16 000000AE: F3 0F 6F 02 movdqu xmm0, dqword[edx] 000000B2: 66 0F 3A 63 04 02 18 pcmpistri xmm0, dqword[edx + eax], EQUAL_EACH + NEGATIVE_POLARITY 000000B9: 77 ED ja STRCMP_LOOP 000000BB: 72 09 jc STRCMP_DIFF 000000BD: 31 C0 xor eax, eax 000000BF: 5A 59 5B C9 C2 08 00 ret 000000C6: STRCMP_DIFF: 000000C6: 89 D8 mov eax, ebx 000000C8: 01 C8 add eax, ecx 000000CA: 5A 59 5B C9 C2 08 00 ret 000000D1: localbytes = current 000000D1: purge ret?,locals?,endl?,proclocal? 000000D1: end namespace 000000D1: purge endp? 000000D1: 0F 1F 80 00 00 00 00 align 8 000000D8: 55 89 E5 51 52 57 56 proc _strstr uses ecx edx edi esi, sStrToSearch, sStrToFind 000000DF: 8B 4D 08 mov ecx, [sStrToSearch] 000000E2: 8B 55 0C mov edx, [sStrToFind] 000000E5: 66 0F EF D2 pxor xmm2, xmm2 000000E9: F3 0F 6F 12 movdqu xmm2, dqword[edx] 000000ED: 66 0F EF DB pxor xmm3, xmm3 000000F1: 8D 41 F0 lea eax, [ecx - 16] 000000F4: STRSTR_MAIN_LOOP: 000000F4: 83 C0 10 add eax, 16 000000F7: 66 0F 3A 63 10 0C pcmpistri xmm2, dqword[eax], EQUAL_ORDERED 000000FD: 77 F5 ja STRSTR_MAIN_LOOP 000000FF: 73 30 jnc STRSTR_NOT_FOUND 00000101: 01 C8 add eax, ecx 00000103: 89 D7 mov edi, edx 00000105: 89 C6 mov esi, eax 00000107: 29 F7 sub edi, esi 00000109: 83 EE 10 sub esi, 16 0000010C: @@: 0000010C: 83 C6 10 add esi, 16 0000010F: F3 0F 6F 0C 3E movdqu xmm1, dqword[esi + edi] 00000114: 66 0F 3A 62 D9 58 pcmpistrm xmm3, xmm1, EQUAL_EACH + NEGATIVE_POLARITY + BYTE_MASK 0000011A: F3 0F 6F 26 movdqu xmm4, dqword[esi] 0000011E: 66 0F DB E0 pand xmm4, xmm0 00000122: 66 0F 3A 63 CC 18 pcmpistri xmm1, xmm4, EQUAL_EACH + NEGATIVE_POLARITY 00000128: 77 E2 ja @b 0000012A: 73 0F jnc STRSTR_FOUND 0000012C: 83 E8 0F sub eax, 15 0000012F: EB C3 jmp STRSTR_MAIN_LOOP 00000131: STRSTR_NOT_FOUND: 00000131: 31 C0 xor eax, eax 00000133: 5E 5F 5A 59 C9 C2 08 00 ret 0000013B: STRSTR_FOUND: 0000013B: 2B 45 08 sub eax, [sStrToSearch] 0000013E: 40 inc eax 0000013F: 5E 5F 5A 59 C9 C2 08 00 ret 00000147: localbytes = current 00000147: purge ret?,locals?,endl?,proclocal? 00000147: end namespace 00000147: purge endp? procf and forcea macros In my previous post I spoke about the force macro and why the need for it. I added two more macros (procf and forcea) that combine the two and also sets align.assume to the same function. As clarified in the previous post, you should only have to use these macros for the first procedure being defined (since nothing calls that procedure). And since its the first function, it should be the starting memory address which is a good place to initially set the align.assume address to. Attached package should include everything needed and has all the previous examples I posted updated. Let me know if I missed something or you have any issues running the examples and thanks for looking Update 04/19/2020: A couple new macros added. I also got rid of the IncludeEx folder and just made one include folder that has the default include folder within it and all others top level. dllstruct macro does the same thing as _fasmg_Au3StructDef(). You can use either one; they both use the macro. getmempos macro does the delta trick I showed below using anonymous labels. stdcallw and invokew macros will push any parameters that are raw (quoted) strings as wide characters Ifex include file gives .if .ifelse .while .until the ability to use stdcall/invoke/etc inline. So if you had a function called "_add" you could do .if stdcall(_add,5,5) = 10. All this basically does in the background is perform the stdcall and then replaces the comparison with eax and passes it on to the original default macros, but is super helpful for cleaning up code and took a ton of time learning the macro language to get in place. Update 05/19/2020: Added fastcallw that does same as stdcallw only Added fastcall support for Ifex Corrected missing include file include\macro\if.inc within win64au3.inc fasmg 5-19-2020.zip Previous versions:
    1 point
  2. Not a single only. Using this StringRegExp($source, "\d+(?=</span>)", 3) you get in the resulting array all the occurences of "one or more digits followed by </span> " This is to be applied on the source code of the concerned page
    1 point
  3. Zedna

    When checkbox is checked

    #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $main = GUICreate("Test", 400, 300) $cbx1 = GUICtrlCreateCheckbox("CBX1", 10, 10, 90, 24) $ed1 = GUICtrlCreateEdit('', 100, 10, 200, 100) GUICtrlSetState($ed1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $cbx1 If IsChecked($cbx1) Then GUICtrlSetState($ed1, $GUI_SHOW) Else GUICtrlSetState($ed1, $GUI_HIDE) EndIf EndSelect WEnd Func IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc
    1 point
  4. It is not just the top level. Using your Notepad example, try it out:
    1 point
  5. Example of looping a menu, and looping through a child menu, to get what you need: #include <GuiMenu.au3> $hwnd = WinGetHandle("[CLASS:Notepad]") WinActivate($hwnd) $hMenu = _GUICtrlMenu_GetMenu($hwnd) $iFile = _GUICtrlMenu_FindItem($hMenu, "File") $hFileMenu = _GUICtrlMenu_GetItemSubMenu($hMenu, $iFile) For $i = 0 To _GUICtrlMenu_GetItemCount($hMenu) - 1 ConsoleWrite(_GUICtrlMenu_GetItemText($hMenu,$i) & " " & @error & @CRLF) Next ConsoleWrite($hFileMenu & @CRLF) For $i = 0 To _GUICtrlMenu_GetItemCount($hFileMenu) - 1 ConsoleWrite("text=[" & _GUICtrlMenu_GetItemText($hFileMenu,$i, True) & "] " & @error & @CRLF) Next &File 0 &Edit 0 F&ormat 0 &View 0 &Help 0 0x000E0869 text=[&New Ctrl+N] 0 text=[&Open... Ctrl+O] 0 text=[&Save Ctrl+S] 0 text=[Save &As...] 0 text=[] 0 text=[Page Set&up...] 0 text=[&Print... Ctrl+P] 0 text=[] 0
    1 point
  6. Usually on the top level menu, if you hold the ALT key down, it will display the trigger keys:
    1 point
  7. Seminko

    shake a window

    Take a look at this.
    1 point
  8. ;~ ******* ;~ Every AccessibleContext IntPtr must be replaced by long, including but not limited to getAccessibleContextFromHWND, getAccessibleParentFromContext, getAccessibleChildFromContext, getAccessibleTextInf ;~ JOBJECT64 is defined as jlong on 64-bit systems and jobject on legacy versions of Java Access Bridge. For definitions, see the section ACCESSBRIDGE_ARCH_LEGACY in the AccessBridgePackages.h header file. ;~ #ifdef ACCESSBRIDGE_ARCH_LEGACY ;~ typedef jobject JOBJECT64; ;~ typedef HWND ABHWND64; ;~ #else ;~ typedef jlong JOBJECT64; ;~ typedef long ABHWND64; ;~ #endif ;~ a jobject is a 32 bit pointer for 32 bit builds ;~ 'bool' is a built-in C++ type while 'BOOL' is a Microsoft specific type that is defined as an 'int'. You can find it in 'windef.h' ;~ ;~ ** jni_md.h ** ;~ typedef long jint; ;~ typedef __int64 jlong; ;~ typedef signed char jbyte; ;~ ******* ;~ accessbridgecalls.h ;~ typedef JOBJECT64 AccessibleContext; ;~ typedef JOBJECT64 AccessibleText; ;~ typedef JOBJECT64 AccessibleValue; ;~ typedef JOBJECT64 AccessibleSelection; ;~ typedef JOBJECT64 Java_Object; ;~ typedef JOBJECT64 PropertyChangeEvent; ;~ typedef JOBJECT64 FocusEvent; ;~ typedef JOBJECT64 CaretEvent; ;~ typedef JOBJECT64 MouseEvent; ;~ typedef JOBJECT64 MenuEvent; ;~ typedef JOBJECT64 AccessibleTable; ;~ typedef JOBJECT64 AccessibleHyperlink; ;~ typedef JOBJECT64 AccessibleHypertext; ;~ Primitive Types and Native Equivalents ;~ Java Type Native Type Description ;~ boolean jboolean unsigned 8 bits ;~ byte jbyte signed 8 bits ;~ char jchar unsigned 16 bits ;~ short jshort signed 16 bits ;~ int jint signed 32 bits ;~ long jlong signed 64 bits ;~ float jfloat 32 bits ;~ double jdouble 64 bits ;~ void void not applicable ;#AutoIt3Wrapper_UseX64 = y Global Const $c_JOBJECT64 = "UINT64" ;~ JOBJECT64 Global Const $cP_JOBJECT64 = "UINT64*" ;~ POINTER(JOBJECT64) ;=====================================Accessibility information================================ Global Const $MAX_BUFFER_SIZE = 10240 Global Const $MAX_STRING_SIZE = 1024 Global Const $SHORT_STRING_SIZE = 256 Global Const $tagAccessBridgeVersionInfo = _ "WCHAR VMversion[256];" & _ ; output of "java -version" "WCHAR bridgeJavaClassVersion[256];" & _ ; version of the AccessBridge.class "WCHAR bridgeJavaDLLVersion[256];" & _ ; version of JavaAccessBridge.dll "WCHAR bridgeWinDLLVersion[256]" ; version of WindowsAccessBridge.dll Global Const $tagAccessibleContextInfo = _ "WCHAR name[1024];" & _ ; the AccessibleName of the object "WCHAR description[1024];" & _ ; the AccessibleDescription of the object "WCHAR role[256];" & _ ; localized AccesibleRole string "WCHAR role_en_US[256];" & _ ; AccesibleRole string in the en_US locale "WCHAR states[256];" & _ ; localized AccesibleStateSet string (comma separated) "WCHAR states_en_US[256];" & _ ; AccesibleStateSet string in the en_US locale (comma separated) "INT indexInParent;" & _ ; index of object in parent "INT childrenCount;" & _ ; # of children, if any "INT x;" & _ ; screen x-axis co-ordinate in pixels "INT y;" & _ ; screen y-axis co-ordinate in pixels "INT width;" & _ ; pixel width of object "INT height;" & _ ; pixel height of object "BOOL accessibleComponent;" & _ ; flags for various additional Java Accessibility interfaces "BOOL accessibleAction;" & _ "BOOL accessibleSelection;" & _ ; FALSE if this object does not implement the additional interface in question "BOOL accessibleText;" & _ "BOOL accessibleInterfaces" ; new bitfield containing additional interface flags Global Const $tagAccessibleTextInfo = _ "INT charCount;" & _ ; # of characters in this text object "INT caretIndex;" & _ ; index of caret "INT indexAtPoint" ; index at the passsed in point Global Const $tagAccessibleTextItemsInfo = _ "WCHAR letter;" & _ "WCHAR word[256];" & _ "WCHAR sentence[1024]" Global Const $tagAccessibleTextSelectionInfo = _ "INT selectionStartIndex;" & _ "INT selectionEndIndex;" & _ "WCHAR selectedText[1024]" Global Const $tagAccessibleTextRectInfo = _ "INT x;" & _ ; bounding recttangle of char at index, x-axis co-ordinate "INT y;" & _ ; y-axis co-ordinate "INT width;" & _ ; bounding rectangle width "INT height" ; bounding rectangle height Global Const $tagAccessibleTextAttributesInfo = _ "BOOL bold;" & _ "BOOL italic;" & _ "BOOL underline;" & _ "BOOL strikethrough;" & _ "BOOL superscript;" & _ "BOOL subscript;" & _ "WCHAR backgroundColor[256];" & _ "WCHAR foregroundColor[256];" & _ "WCHAR fontFamily[256];" & _ "INT fontSize;" & _ "INT alignment;" & _ "INT bidiLevel;" & _ "FLOAT firstLineIndent;" & _ "FLOAT LeftIndent;" & _ "FLOAT rightIndent;" & _ "FLOAT lineSpacing;" & _ "FLOAT spaceAbove;" & _ "FLOAT spaceBelow;" & _ "WCHAR fullAttributesString[1024]" ;=====================================AccessibleTable================================ Global Const $MAX_TABLE_SELECTIONS = 64 Global Const $tagAccessibleTableInfo = _ "UINT64 caption;" & _ ; AccessibleContext "UINT64 summary;" & _ ; AccessibleContext "INT rowCount;" & _ "INT columnCount;" & _ "UINT64 accessibleContext;" & _ "UINT64 accessibleTable" Global Const $tagAccessibleTableCellInfo = _ "UINT64 accessibleContext;" & _ "INT index;" & _ "INT row;" & _ "INT column;" & _ "INT rowExtent;" & _ "INT columnExtent;" & _ "BOOL isSelected" ;=====================================AccessibleRelationSet================================ Global Const $MAX_RELATION_TARGETS = 25 Global Const $MAX_RELATIONS = 5 Global Const $tagAccessibleRelationInfo = _ "WCHAR key[256];" & _ "INT targetCount;" & _ "UINT64 targets[25]" ; AccessibleContexts Local $tag_Relations = "" For $i = 1 To 5 If $tag_Relations = "" Then $tag_Relations = $tagAccessibleRelationInfo Else $tag_Relations = $tag_Relations & ";" & $tagAccessibleRelationInfo EndIf Next Global Const $tagAccessibleRelationSetInfo = _ "INT relationCount;" & _ $tag_Relations ; $tAccessibleRelationInfo relations[5] ;=====================================AccessibleHypertext================================ Global Const $MAX_HYPERLINKS = 64 ;~ maximum number of hyperlinks returned Global Const $tagAccessibleHyperlinkInfo = _ "WCHAR text[256];" & _ ; the hyperlink text "INT startIndex;" & _ ; index in the hypertext document where the link begins "INT endIndex;" & _ ; index in the hypertext document where the link ends "UINT64 accessibleHyperlink" ; AccessibleHyperlink object Local $tag_Links = "" For $i = 1 To 64 If $tag_Links = "" Then $tag_Links = $tagAccessibleHyperlinkInfo Else $tag_Links = $tag_Links & ";" & $tagAccessibleHyperlinkInfo EndIf Next Global Const $tagAccessibleHypertextInfo = _ "INT linkCount;" & _ ; number of hyperlinks $tag_Links & ";" & _ ; the hyperlinks ,$tAccessibleHyperlinkInfo links[64] "UINT64 accessibleHypertext" ; AccessibleHypertext object ;=====================================Accessible Key Bindings================================ Global Const $MAX_KEY_BINDINGS = 8 Global Const $tagAccessibleKeyBindingInfo = _ "WCHAR character;" & _ ; the key character "INT modifiers" ; the key modifiers Local $tag_KeyBindingInfo = "" For $i = 1 To 8 If $tag_KeyBindingInfo = "" Then $tag_KeyBindingInfo = $tagAccessibleKeyBindingInfo Else $tag_KeyBindingInfo = $tag_KeyBindingInfo & ";" & $tagAccessibleKeyBindingInfo EndIf Next Global Const $tagAccessibleKeyBindings = _ "INT keyBindingsCount;" & _ ; number of key bindings $tag_KeyBindingInfo ; $tAccessibleKeyBindingInfo keyBindingInfo[8] ;=====================================AccessibleIcon================================ Global Const $MAX_ICON_INFO = 8 Global Const $tagAccessibleIconInfo = _ "WCHAR description[256];" & _ ; icon description "INT height;" & _ ; icon height "INT width" ; icon width Local $tag_IconInfo = "" For $i = 1 To 8 If $tag_IconInfo = "" Then $tag_IconInfo = $tagAccessibleIconInfo Else $tag_IconInfo = $tag_IconInfo & ";" & $tagAccessibleIconInfo EndIf Next Global Const $tagAccessibleIcon = _ "INT iconsCount;" & _ ; number of icons $tag_IconInfo ; the icons ,$tAccessibleIconInfo iconInfo[8] ;=====================================AccessibleAction================================ Global Const $MAX_ACTION_INFO = 256 Global Const $MAX_ACTIONS_TO_DO = 32 Global Const $tagAccessibleActionInfo = _ "WCHAR name[256]" Local $tag_ActionInfo = "" For $i = 1 To 256 If $tag_ActionInfo = "" Then $tag_ActionInfo = $tagAccessibleActionInfo Else $tag_ActionInfo = $tag_ActionInfo & ";" & $tagAccessibleActionInfo EndIf Next Global Const $tagAccessibleActions = _ "INT actionsCount;" & _ $tag_ActionInfo ; $tAccessibleActionInfo actionInfo[256] Local $tag_Actions = "" For $i = 1 To 32 If $tag_Actions = "" Then $tag_Actions = $tagAccessibleActionInfo Else $tag_Actions = $tag_Actions & ";" & $tagAccessibleActionInfo EndIf Next Global Const $tagAccessibleActionsToDo = _ "INT actionsCount;" & _ $tag_Actions ; $tAccessibleActions actions[32] ;=====================================VisibleChilden================================ Global Const $MAX_VISIBLE_CHILDREN = 256 Global Const $tagVisibleChildenInfo = _ "INT returnedChildrenCount;" & _ ; number of children returned "UINT64 children[256]" ; the visible children Global $hAccessBridgeDll ;~ reference to the accessbridge dll _JAB_init() Func _JAB_init() ;~ Determine java location Local $sJavaVersion Local $sJavaHome Local $sAccessBridgeDLL If @OSArch = "X86" Then Local $sJavaReg = "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" $sJavaVersion = RegRead($sJavaReg, "CurrentVersion") $sJavaHome = RegRead($sJavaReg & "\" & $sJavaVersion, "JavaHome") ElseIf @OSArch = "X64" Then Local $sJavaReg64 = "HKLM64\SOFTWARE\JavaSoft\Java Runtime Environment" Local $sJavaReg32 = "HKLM64\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" $sJavaVersion = RegRead($sJavaReg32, "CurrentVersion") $sJavaHome = RegRead($sJavaReg32 & "\" & $sJavaVersion, "JavaHome") If $sJavaVersion = "" Then $sJavaVersion = RegRead($sJavaReg64, "CurrentVersion") $sJavaHome = RegRead($sJavaReg64 & "\" & $sJavaVersion, "JavaHome") EndIf EndIf If $sJavaHome = "" Then consolewrite(" Unable to find Java Registry " & @CRLF) Return EndIf consolewrite(" Java Home: " & $sJavaHome & @CRLF) ;~ TODO: Check which dll that Autoit can work with, still can't find eazy way to work with both dlls consolewrite(" We are using OS " & @OSArch & " at cpu " & @CPUArch & "; Autoit 64 bit version @AutoItX64="& @AutoItX64 & @CRLF) ;~ Only Autoit 64 bit version can open WindowsAccessBridge-64.dll, so use @AutoItX64 to decide which WindowsAccessBridge can be opened $sAccessBridgeDLL = (@AutoItX64) ? "WindowsAccessBridge-64.dll" : "WindowsAccessBridge-32.dll" ;~ Open the Dll for accessibility $hAccessBridgeDll = DllOpen($sJavaHome & "\bin\" & $sAccessBridgeDLL) If $hAccessBridgeDll <> -1 Then ConsoleWrite(" PASS: Windows accessbridge " & $sAccessBridgeDLL & " opened returns: " & $hAccessBridgeDll & @CRLF) Else ConsoleWrite(" ERROR: Windows accessbridge " & $sAccessBridgeDLL & " open failed returns: " & $hAccessBridgeDll & @CRLF) Return EndIf ;~ Make sure Java Access Bridge is turned on Runwait($sJavaHome & "\bin\jabswitch /enable","",@SW_MAXIMIZE) ;~ TODO: Handle messages received from initialize $result = __Windows_run() consolewrite(@error & " Windows_run returns: " & $result & @CRLF) ;$result = __initializeAccessBridge() ;consolewrite($result & " " & @error & " initializeAccessBridge is finished" & @CRLF) EndFunc Func _JAB_shutDown() __shutdownAccessBridge() EndFunc Func _JAB_getName($vmId, $ac) Local $acInfo = DllStructCreate($tagAccessibleContextInfo) __getAccessibleContextInfo($vmId, $ac, $acInfo) Return DllStructGetData($acInfo, "name") EndFunc Func _JAB_getRole($vmId, $ac) Local $acInfo = DllStructCreate($tagAccessibleContextInfo) __getAccessibleContextInfo($vmId, $ac, $acInfo) Return DllStructGetData($acInfo, "role") EndFunc Func _JAB_getIndexInParent($vmId, $ac) Local $acInfo = DllStructCreate($tagAccessibleContextInfo) __getAccessibleContextInfo($vmId, $ac, $acInfo) Return DllStructGetData($acInfo, "indexInParent") EndFunc Func _JAB_getChildrenCount($vmId, $ac) Local $acInfo = DllStructCreate($tagAccessibleContextInfo) __getAccessibleContextInfo($vmId, $ac, $acInfo) Return DllStructGetData($acInfo, "childrenCount") EndFunc ;~ Must use the AccessibleContext got from the win handle which include the target element Func _JAB_getAccessibleContextByFindAll($vmId, $ac, $sName, $sRole) Local $find_ac = 0 Local $iCount =_JAB_getChildrenCount($vmId, $ac) If $iCount = 0 Then Return EndIf For $i = 0 To $iCount - 1 Local $child_ac = __getAccessibleChildFromContext($vmId, $ac, $i) Local $s1 = _JAB_getName($vmId, $child_ac) Local $s3 = _JAB_getRole($vmId, $child_ac) ; consolewrite($child_ac & "|" & $s1 & "," & $s3 & @CRLF) If $s1 = $sName And $s3 = $sRole Then $find_ac = $child_ac ExitLoop Else If $find_ac = 0 Then $find_ac = _JAB_getAccessibleContextByFindAll($vmId, $child_ac, $sName, $sRole) EndIf EndIf Next Return $find_ac EndFunc ;~ $next can be negative Func _JAB_getNextSibling($vmId, $ac, $next = 1) If Not IsInt($next) Then consolewrite("_JAB_findNextSibling: $next must be int" & @CRLF) Return EndIf Local $s7 = _JAB_getIndexInParent($vmId, $ac) Local $parent_ac = __getAccessibleParentFromContext($vmId, $ac) Local $parent_s8 = _JAB_getChildrenCount($vmId, $parent_ac) If $s7 + $next >= 0 and $s7 + $next <= $parent_s8 - 1 Then Local $sibling_ac = __getAccessibleChildFromContext($vmId, $parent_ac, $s7 + $next) Return $sibling_ac EndIf EndFunc Func _JAB_getFirstChildByRole($vmId, $ac, $sRole) Local $iCount = _JAB_getChildrenCount($vmId, $ac) If $iCount = 0 Then Return EndIf Local $re1 = -1 For $i = 0 To $iCount - 1 Local $child_ac = __getAccessibleChildFromContext($vmId, $ac, $i) Local $child_ac_s3 = _JAB_getRole($vmId, $child_ac) If $child_ac_s3 = $sRole Then $re1 = $child_ac Return $child_ac ExitLoop EndIf Next If $re1 = -1 Then consolewrite("_JAB_getFirstChildByRole: " & $sRole & " is not found" & @CRLF) Return EndIf EndFunc ;~ list element's actions Func _JAB_getAllActions($vmId, $ac) Local $actions = DllStructCreate($tagAccessibleActions) __getAccessibleActions($vmId, $ac, $actions) Local $s1 = DllStructGetData($actions, "actionsCount") If $s1 = 0 Then consolewrite("_JAB_findAllActions: this element has no action" & @CRLF) Return EndIf Local $re = "" For $i = 2 To $s1 + 1 Local $s = $i&"|"&DllStructGetData($actions, $i)&@CRLF If $re = "" Then $re = $s Else $re = $re & $s EndIf Next Return $re EndFunc ;~ Only applicable for single action element like button or check box, menu, menu item Func _JAB_singleAction($vmId, $ac) Local $actions = DllStructCreate($tagAccessibleActions) Local $actionsToDo = DllStructCreate($tagAccessibleActionsToDo) __getAccessibleActions($vmId, $ac, $actions) Local $s1 = DllStructGetData($actions, "actionsCount") Local $s2 = DllStructGetData($actions, 2) If $s1 <> 1 Then consolewrite("_JAB_singleAction: Only applicable for single action element like button or check box, menu, menu item" & @CRLF) Return EndIf Local $failure DllStructSetData($actionsToDo, "actionsCount", 1) DllStructSetData($actionsToDo, 2, $s2) __doAccessibleActions($vmId, $ac, $actionsToDo, $failure) EndFunc Func _JAB_setValue($vmId, $ac, $sValue) Local $actions = DllStructCreate($tagAccessibleActions) __getAccessibleActions($vmId, $ac, $actions) Local $s1 = DllStructGetData($actions, "actionsCount") If $s1 = 0 Then consolewrite("_JAB_setValue: this element has no action" & @CRLF) Return EndIf Local $re1 = 0 Local $re2 = 0 For $i = 2 To $s1 + 1 Local $s = DllStructGetData($actions, $i) If $s = "select-all" Then $re1 = 1 ExitLoop EndIf Next If $re1 = 0 Then consolewrite("_JAB_setValue: this element doesn't support select-all action" & @CRLF) Return EndIf For $i = 2 To $s1 + 1 Local $s = DllStructGetData($actions, $i) If $s = "paste-from-clipboard" Then $re2 = 1 ExitLoop EndIf Next If $re2 = 0 Then consolewrite("_JAB_setValue: this element doesn't support paste-from-clipboard action" & @CRLF) Return EndIf Local $actionsToDo = DllStructCreate($tagAccessibleActionsToDo) Local $failure ClipPut($sValue) DllStructSetData($actionsToDo, "actionsCount", 2) DllStructSetData($actionsToDo, 2, "select-all") DllStructSetData($actionsToDo, 3, "paste-from-clipboard") __doAccessibleActions($vmId, $ac, $actionsToDo, $failure) EndFunc Func _JAB_getValue($vmId, $ac) Local $actions = DllStructCreate($tagAccessibleActions) __getAccessibleActions($vmId, $ac, $actions) Local $s1 = DllStructGetData($actions, "actionsCount") If $s1 = 0 Then consolewrite("_JAB_getValue: this element has no action" & @CRLF) Return EndIf Local $re1 = 0 For $i = 2 To $s1 + 1 Local $s = DllStructGetData($actions, $i) If $s = "copy-to-clipboard" Then $re1 = 1 ExitLoop EndIf Next If $re1 = 0 Then consolewrite("_JAB_getValue: this element doesn't support copy-to-clipboard action" & @CRLF) Return EndIf ;~ empty the clipboard ClipPut("") Local $actionsToDo = DllStructCreate($tagAccessibleActionsToDo) Local $failure DllStructSetData($actionsToDo, "actionsCount", 1) DllStructSetData($actionsToDo, 2, "copy-to-clipboard") __doAccessibleActions($vmId, $ac, $actionsToDo, $failure) Return ClipGet() EndFunc Func _JAB_selectCheckBox($vmId, $ac) Local $acInfo = DllStructCreate($tagAccessibleContextInfo) __getAccessibleContextInfo($vmId, $ac, $acInfo) Local $s3 = DllStructGetData($acInfo, "role") If $s3 <> "check box" Then consolewrite("_JAB_selectCheckBox: this element isn't check box" & @CRLF) Return EndIf Local $s6 = DllStructGetData($acInfo, "states_en_US") If StringInStr($s6, "checked") Then Return Else _JAB_singleAction($vmId, $ac) EndIf EndFunc Func _JAB_unselectCheckBox($vmId, $ac) Local $acInfo = DllStructCreate($tagAccessibleContextInfo) __getAccessibleContextInfo($vmId, $ac, $acInfo) Local $s3 = DllStructGetData($acInfo, "role") If $s3 <> "check box" Then consolewrite("_JAB_unselectCheckBox: this element isn't check box" & @CRLF) Return EndIf Local $s6 = DllStructGetData($acInfo, "states_en_US") If StringInStr($s6, "checked") Then _JAB_singleAction($vmId, $ac) EndIf EndFunc ;~ scroll pane-->viewport-->table ;~ |-->scroll bar ;~ |-->scroll bar ;~ |-->viewport-->panel-->panel:column1 ;~ |-->panel:column2 ;~ Must use unique name to find column ac Func _JAB_getTableFromColumn($vmId, $ac) Local $p1_ac = __getAccessibleParentFromContext($vmId, $ac) Local $p2_ac = __getAccessibleParentFromContext($vmId, $p1_ac) Local $s3 = _JAB_getRole($vmId, $p2_ac) If $s3 <> "viewport" Then consolewrite("_JAB_getTableFromColumn: find wrong column viewport" & @CRLF) Return EndIf Local $p3_ac = __getAccessibleParentFromContext($vmId, $p2_ac) Local $iCount = _JAB_getChildrenCount($vmId, $p3_ac) For $i = 0 To $iCount - 1 Local $child_ac = __getAccessibleChildFromContext($vmId, $p3_ac, $i) Local $child_s3 = _JAB_getRole($vmId, $child_ac) If $child_s3 = "viewport" Then ;~ first child is table, begin from 0 Local $grandson_ac = __getAccessibleChildFromContext($vmId, $child_ac, 0) Local $grandson_s3 = _JAB_getRole($vmId, $grandson_ac) If $grandson_s3 = "table" Then Return $grandson_ac ExitLoop EndIf EndIf Next EndFunc ;~ row and column begin from 0 Func _JAB_getTableCellText($vmId, $ac, $iRow = 0, $iColumn = 0) If Not IsInt($iRow) Or Not IsInt($iColumn) Then consolewrite("_JAB_getTableCellText: $iRow and $iColumn must be int" & @CRLF) Return EndIf Local $s3 = _JAB_getRole($vmId, $ac) If $s3 <> "table" Then consolewrite("_JAB_getTableCellText: this element isn't table" & @CRLF) Return EndIf Local $tableInfo = DllStructCreate($tagAccessibleTableInfo) __getAccessibleTableInfo($vmId, $ac, $tableInfo) Local $table_s3 = DllStructGetData($tableInfo, "rowCount") Local $table_s4 = DllStructGetData($tableInfo, "columnCount") Local $table_s6 = DllStructGetData($tableInfo, "accessibleTable") If $iRow < 0 Or $iRow > $table_s3 - 1 Then consolewrite("_JAB_getTableCellText: $iRow out of range" & @CRLF) Return EndIf If $iColumn < 0 Or $iColumn > $table_s4 - 1 Then consolewrite("_JAB_getTableCellText: $iColumn out of range" & @CRLF) Return EndIf Local $tableCellInfo = DllStructCreate($tagAccessibleTableCellInfo) __getAccessibleTableCellInfo($vmId, $table_s6, $iRow, $iColumn, $tableCellInfo) Local $cell_s1 = DllStructGetData($tableCellInfo, "accessibleContext") Return _JAB_getName($vmId, $cell_s1) EndFunc Func _JAB_selectAFromTableWhereB($vmId, $ac, $iColumnA, $iColumnB, $sB) If Not IsInt($iColumnA) Or Not IsInt($iColumnB) Then consolewrite("_JAB_selectAFromTableWhereB: $iColumnA and $iColumnB must be int" & @CRLF) Return EndIf Local $s3 = _JAB_getRole($vmId, $ac) If $s3 <> "table" Then consolewrite("_JAB_selectAFromTableWhereB: this element isn't table" & @CRLF) Return EndIf Local $tableInfo = DllStructCreate($tagAccessibleTableInfo) __getAccessibleTableInfo($vmId, $ac, $tableInfo) Local $table_s3 = DllStructGetData($tableInfo, "rowCount") Local $table_s4 = DllStructGetData($tableInfo, "columnCount") Local $table_s6 = DllStructGetData($tableInfo, "accessibleTable") If $iColumnA < 0 Or $iColumnA > $table_s4 - 1 Then consolewrite("_JAB_selectAFromTableWhereB: $iColumnA out of range" & @CRLF) Return EndIf If $iColumnB < 0 Or $iColumnB > $table_s4 - 1 Then consolewrite("_JAB_selectAFromTableWhereB: $iColumnB out of range" & @CRLF) Return EndIf Local $re = -1 For $i = 0 To $table_s3 - 1 Local $tableCellInfo = DllStructCreate($tagAccessibleTableCellInfo) __getAccessibleTableCellInfo($vmId, $table_s6, $i, $iColumnB, $tableCellInfo) Local $cell_s1 = DllStructGetData($tableCellInfo, "accessibleContext") Local $s1 = _JAB_getName($vmId, $cell_s1) If StringInStr($s1, $sB) Then $re = 1 __getAccessibleTableCellInfo($vmId, $table_s6, $i, $iColumnA, $tableCellInfo) Local $cell_s2 = DllStructGetData($tableCellInfo, "accessibleContext") Return _JAB_getName($vmId, $cell_s2) ExitLoop EndIf Next If $re = -1 Then consolewrite("_JAB_selectAFromTableWhereB: " & $sB & " is not found" & @CRLF) Return EndIf EndFunc Func _JAB_menuSelectItem($vmId, $ac, $item1 = "", $item2 = "", $item3 = "", $item4 = "", $item5 = "", $item6 = "") Local $s3 = _JAB_getRole($vmId, $ac) If $s3 <> "menu" Then consolewrite("_JAB_menuSelectItem: this element isn't menu" & @CRLF) Return EndIf _JAB_singleAction($vmId, $ac) Sleep(250) If $item1 <> "" Then Local $re1 = -1 Local $iCount = _JAB_getChildrenCount($vmId, $ac) For $i = 0 To $iCount - 1 Local $ac1 = __getAccessibleChildFromContext($vmId, $ac, $i) Local $ac1_s1 = _JAB_getName($vmId, $ac1) If StringInStr($ac1_s1, $item1) Then _JAB_singleAction($vmId, $ac1) Sleep(250) $re1 = $ac1 ExitLoop EndIf Next If $re1 = -1 Then consolewrite("_JAB_menuSelectItem: " & $item1 & " is not found" & @CRLF) Return EndIf If $item2 <> "" Then Local $re2 = -1 Local $iCount = _JAB_getChildrenCount($vmId, $re1) For $i = 0 To $iCount - 1 Local $ac2 = __getAccessibleChildFromContext($vmId, $re1, $i) Local $ac2_s1 = _JAB_getName($vmId, $ac2) If StringInStr($ac2_s1, $item2) Then _JAB_singleAction($vmId, $ac2) Sleep(250) $re2 = $ac2 ExitLoop EndIf Next If $re2 = -1 Then consolewrite("_JAB_menuSelectItem: " & $item2 & " is not found" & @CRLF) Return EndIf If $item3 <> "" Then Local $re3 = -1 Local $iCount = _JAB_getChildrenCount($vmId, $re2) For $i = 0 To $iCount - 1 Local $ac3 = __getAccessibleChildFromContext($vmId, $re2, $i) Local $ac3_s1 = _JAB_getName($vmId, $ac3) If StringInStr($ac3_s1, $item3) Then _JAB_singleAction($vmId, $ac3) Sleep(250) $re3 = $ac3 ExitLoop EndIf Next If $re3 = -1 Then consolewrite("_JAB_menuSelectItem: " & $item3 & " is not found" & @CRLF) Return EndIf If $item4 <> "" Then Local $re4 = -1 Local $iCount = _JAB_getChildrenCount($vmId, $re3) For $i = 0 To $iCount - 1 Local $ac4 = __getAccessibleChildFromContext($vmId, $re3, $i) Local $ac4_s1 = _JAB_getName($vmId, $ac4) If StringInStr($ac4_s1, $item4) Then _JAB_singleAction($vmId, $ac4) Sleep(250) $re4 = $ac4 ExitLoop EndIf Next If $re4 = -1 Then consolewrite("_JAB_menuSelectItem: " & $item4 & " is not found" & @CRLF) Return EndIf If $item5 <> "" Then Local $re5 = -1 Local $iCount = _JAB_getChildrenCount($vmId, $re4) For $i = 0 To $iCount - 1 Local $ac5 = __getAccessibleChildFromContext($vmId, $re4, $i) Local $ac5_s1 = _JAB_getName($vmId, $ac5) If StringInStr($ac5_s1, $item5) Then _JAB_singleAction($vmId, $ac5) Sleep(250) $re5 = $ac5 ExitLoop EndIf Next If $re5 = -1 Then consolewrite("_JAB_menuSelectItem: " & $item5 & " is not found" & @CRLF) Return EndIf If $item6 <> "" Then Local $re6 = -1 Local $iCount = _JAB_getChildrenCount($vmId, $re5) For $i = 0 To $iCount - 1 Local $ac6 = __getAccessibleChildFromContext($vmId, $re5, $i) Local $ac6_s1 = _JAB_getName($vmId, $ac6) If StringInStr($ac6_s1, $item6) Then _JAB_singleAction($vmId, $ac6) Sleep(250) $re6 = $ac6 ExitLoop EndIf Next If $re6 = -1 Then consolewrite("_JAB_menuSelectItem: " & $item6 & " is not found" & @CRLF) Return EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndFunc ;~ combo box-->popup menu-->scroll pane-->viewport-->list- ;~ | |-->label 0 ;~ | |-->label 1 ;~ | |-->label 2 ;~ | |-->label 3 ;~ -->scroll bar Func _JAB_comboBoxSelectItem($vmId, $ac, $listItem) Local $s3 = _JAB_getRole($vmId, $ac) If $s3 <> "combo box" Then consolewrite("_JAB_comboBoxSelectItem: this element isn't combo box" & @CRLF) Return EndIf Local $popup_ac = _JAB_getFirstChildByRole($vmId, $ac, "popup menu") If $popup_ac = "" Then consolewrite("_JAB_comboBoxSelectItem: popup menu is not found" & @CRLF) Return EndIf Local $scroll_ac = _JAB_getFirstChildByRole($vmId, $popup_ac, "scroll pane") If $scroll_ac = "" Then consolewrite("_JAB_comboBoxSelectItem: scroll pane is not found" & @CRLF) Return EndIf Local $viewport_ac = _JAB_getFirstChildByRole($vmId, $scroll_ac, "viewport") If $viewport_ac = "" Then consolewrite("_JAB_comboBoxSelectItem: viewport is not found" & @CRLF) Return EndIf Local $list_ac = _JAB_getFirstChildByRole($vmId, $viewport_ac, "list") If $list_ac = "" Then consolewrite("_JAB_comboBoxSelectItem: list is not found" & @CRLF) Return EndIf Local $re2 = -1 Local $iCount = _JAB_getChildrenCount($vmId, $list_ac) For $i = 0 To $iCount - 1 Local $child_ac = __getAccessibleChildFromContext($vmId, $list_ac, $i) Local $child_ac_s1 = _JAB_getName($vmId, $child_ac) If StringInStr($child_ac_s1 ,$listItem) Then $re2 = $i ExitLoop EndIf Next If $re2 = -1 Then consolewrite("_JAB_comboBoxSelectItem: " & $listItem & " is not found" & @CRLF) Return EndIf __addAccessibleSelectionFromContext($vmId, $ac, $re2) EndFunc ;~ _fixBridgeFunc(None,'Windows_run') Func __Windows_run() $result = DllCall($hAccessBridgeDll, "NONE", "Windows_run") If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ _fixBridgeFunc(None,'setFocusGainedFP',c_void_p) ;~ _fixBridgeFunc(None,'setPropertyNameChangeFP',c_void_p) ;~ _fixBridgeFunc(None,'setPropertyDescriptionChangeFP',c_void_p) ;~ _fixBridgeFunc(None,'setPropertyValueChangeFP',c_void_p) ;~ _fixBridgeFunc(None,'setPropertyStateChangeFP',c_void_p) ;~ _fixBridgeFunc(None,'setPropertyCaretChangeFP',c_void_p) ;~ _fixBridgeFunc(None,'setPropertyActiveDescendentChangeFP',c_void_p) ;========================================Initialization/Shutdown Functions========================================== ; Starts Java Access Bridge. You can't use any part of the Java Access Bridge API until you call this function. Func __initializeAccessBridge() $result = DllCall($hAccessBridgeDll, "NONE", "initializeAccessBridge") If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; Shuts down Java Access Bridge. Func __shutdownAccessBridge() $result = DllCall($hAccessBridgeDll, "NONE", "shutdownAccessBridge") If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;========================================Gateway Functions========================================================= ;~ BOOL IsJavaWindow(HWND window) ; Checks to see if the given window implements the Java Accessibility API. Func __isJavaWindow($hwnd) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "isJavaWindow", "hwnd", $hwnd) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ BOOL GetAccessibleContextFromHWND(HWND target, long *vmID, AccessibleContext *ac) ; Returns the virtual machine ID and AccessibleContext for a top-level window. Func __getAccessibleContextFromHWND($hwnd, byref $vmID, byref $ac) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleContextFromHWND", "hwnd", $hwnd, "long*", $vmId, $cP_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) $vmID = $result[2] $ac = $result[3] Return $result[0] EndFunc ;========================================General Functions========================================================= ;~ void ReleaseJavaObject(long vmID, Java_Object object) ; Release the memory used by the Java object object, where object is an object returned to you by Java Access Bridge. Func __releaseJavaObject($vmId, $object) $result = DllCall($hAccessBridgeDll, "NONE", "releaseJavaObject", "long", $vmId, $c_JOBJECT64, $object) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ BOOL GetVersionInfo(long vmID, AccessBridgeVersionInfo *info) ; Gets the version information of the instance of Java Access Bridge instance your application is using. ; $tAccessBridgeVersionInfo $info Func __getVersionInfo($vmId, byref $info) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getVersionInfo", "long", $vmId, "struct*", $info) If @error Then Return SetError(1, 0, 0) $info = $result[2] Return $result[0] EndFunc ;========================================Accessible Context Functions========================================================= ;~ BOOL GetAccessibleContextAt(long vmID, AccessibleContext acParent, jint x, jint y, AccessibleContext *ac) ; Retrieves an AccessibleContext object of the window or object that is under the mouse pointer. Func __getAccessibleContextAt($vmId, $acParent, $x, $y, byref $ac) ;~ Seems not to be allowed to call with null so passing $acParent $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleContextAt", "long", $vmId, $c_JOBJECT64, $acParent, "int", $x, "int", $y, $cP_JOBJECT64, $ac) consolewrite(@error) If @error Then Return SetError(1, 0, 0) $ac = $result[5] Return $result[0] EndFunc ;~ BOOL GetAccessibleContextWithFocus(HWND window, long *vmID, AccessibleContext *ac) ; Retrieves an AccessibleContext object of the window or object that has the focus. Func __getAccessibleContextWithFocus($hwnd, byref $vmID, byref $ac) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleContextWithFocus", "hwnd", $hwnd, "long*", $vmId, $cP_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) $vmID = $result[2] $ac = $result[3] Return $result[0] EndFunc ;~ BOOL GetAccessibleContextInfo(long vmID, AccessibleContext ac, AccessibleContextInfo *info) ; Retrieves an AccessibleContextInfo object of the AccessibleContext object ac. ; $tAccessibleContextInfo $info Func __getAccessibleContextInfo($vmId, $ac, byref $info) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleContextInfo", "long", $vmId, $c_JOBJECT64, $ac, "struct*", $info) If @error Then Return SetError(1, 0, 0) $info = $result[3] Return $result[0] EndFunc ;~ AccessibleContext GetAccessibleChildFromContext(long vmID, AccessibleContext ac, jint index)) ; Returns an AccessibleContext object that represents the nth child of the object ac, where n is specified by the value index. Func __getAccessibleChildFromContext($vmId, $ac, $index) ;~ Seems not to be allowed to call with null so passing $acParent $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getAccessibleChildFromContext", "long", $vmId, $c_JOBJECT64, $ac, "int", $index) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ AccessibleContext GetAccessibleParentFromContext(long vmID, AccessibleContext ac) ; Returns an AccessibleContext object that represents the parent of object ac. Func __getAccessibleParentFromContext($vmId, $ac) $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getAccessibleParentFromContext", "long", $vmId, $c_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ HWND getHWNDFromAccessibleContext(long vmID, AccessibleContext ac) ; Returns the HWND from the AccessibleContextof a top-level window. Func __getHWNDFromAccessibleContext($vmId, $ac) $result = DllCall($hAccessBridgeDll, "hwnd", "getHWNDFromAccessibleContext", "long", $vmId, $c_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;========================================Accessible Text Functions========================================================= ;~ BOOL GetAccessibleTextInfo(long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y) ; $tAccessibleTextInfo $textInfo Func __getAccessibleTextInfo($vmId, $at, byref $textInfo, $x, $y) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTextInfo", "long", $vmId, $c_JOBJECT64, $at, "struct*", $textInfo, "int", $x, "int", $y) If @error Then Return SetError(1, 0, 0) $textInfo = $result[3] Return $result[0] EndFunc ;~ BOOL GetAccessibleTextItems(long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index) ; $tAccessibleTextItemsInfo $textItems Func __getAccessibleTextItems($vmId, $at, byref $textItems, $index) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTextItems", "long", $vmId, $c_JOBJECT64, $at, "struct*", $textItems, "int", $index) If @error Then Return SetError(1, 0, 0) $textItems = $result[3] Return $result[0] EndFunc ;~ BOOL GetAccessibleTextSelectionInfo(long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection) ; $tAccessibleTextSelectionInfo $textSelection Func __getAccessibleTextSelectionInfo($vmId, $at, byref $textSelection) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTextSelectionInfo", "long", $vmId, $c_JOBJECT64, $at, "struct*", $textSelection) If @error Then Return SetError(1, 0, 0) $textSelection = $result[3] Return $result[0] EndFunc ;~ BOOL GetAccessibleTextAttributes(long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes) ; $tAccessibleTextAttributesInfo $attributes Func __getAccessibleTextAttributes($vmId, $at, $index, byref $attributes) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTextAttributes", "long", $vmId, $c_JOBJECT64, $at, "int", $index, "struct*", $attributes) If @error Then Return SetError(1, 0, 0) $attributes = $result[4] Return $result[0] EndFunc ; BOOL GetAccessibleTextRect(long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index); ; $tAccessibleTextRectInfo $rectInfo Func __getAccessibleTextRect($vmId, $at, byref $rectInfo, $index) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTextRect", "long", $vmId, $c_JOBJECT64, $at, "struct*", $rectInfo, "int", $index) If @error Then Return SetError(1, 0, 0) $attributes = $result[3] Return $result[0] EndFunc ;~ BOOL GetAccessibleTextRange(long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len) Func __getAccessibleTextRange($vmId, $at, $start, $end, $text, $len) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTextRange", "long", $vmId, $c_JOBJECT64, $at, "int", $start, "int", $end, "wstr", $text, "short", $len) If @error Then Return SetError(1, 0, 0) $text = $result[5] Return $result[0] EndFunc ;~ BOOL GetAccessibleTextLineBounds(long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex) Func __getAccessibleTextLineBounds($vmId, $at, $index, byref $startIndex, byref $endIndex) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTextLineBounds", "long", $vmId, $c_JOBJECT64, $at, "int", $index, "int*", $startIndex, "int*", $endIndex) If @error Then Return SetError(1, 0, 0) $startIndex = $result[4] $endIndex = $result[5] Return $result[0] EndFunc ;========================================Additional Text Functions========================================================= ;~ _fixBridgeFunc(BOOL,'selectTextRange',c_long,JOBJECT64,c_int,c_int,errcheck=True) ; Selects text between two indices. Selection includes the text at the start index and the text at the end index. ; AccessibleContext $ac Func __selectTextRange($vmId, $ac, $startIndex, $endIndex) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "selectTextRange", "long", $vmId, $c_JOBJECT64, $ac, "int", $startIndex, "int", $endIndex) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ _fixBridgeFunc(BOOL,'getTextAttributesInRange',c_long,JOBJECT64,c_int,c_int,POINTER(AccessibleTextAttributesInfo),POINTER(c_short),errcheck=True) ; Get text attributes between two indices. The attribute list includes the text at the start index and the text at the end index. ; AccessibleContext $ac ; $tAccessibleTextAttributesInfo $attributes Func __getTextAttributesInRange($vmId, $ac, $startIndex, $endIndex, byref $attributes, byref $len) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getTextAttributesInRange", "long", $vmId, $c_JOBJECT64, $ac, "int", $startIndex, "int", $endIndex, "struct*", $attributes, "short*", $len) If @error Then Return SetError(1, 0, 0) $attributes = $result[5] $len = $result[6] Return $result[0] EndFunc ;~ _fixBridgeFunc(BOOL,'setCaretPosition',c_long,JOBJECT64,c_int,errcheck=True) ; Set the caret to a text position. ; AccessibleContext $ac Func __setCaretPosition($vmId, $ac, $position) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "setCaretPosition", "long", $vmId, $c_JOBJECT64, $ac, "int", $position) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ _fixBridgeFunc(BOOL,'getCaretLocation',c_long,JOBJECT64,POINTER(AccessibleTextRectInfo),jint,errcheck=True) ; Gets the text caret location. ; AccessibleContext $ac ; $tAccessibleTextRectInfo $rectInfo Func __getCaretLocation($vmId, $ac, byref $rectInfo, $position) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getCaretLocation", "long", $vmId, $c_JOBJECT64, $ac, "struct*", $position, "int", $position) If @error Then Return SetError(1, 0, 0) $rectInfo = $result[3] Return $result[0] EndFunc ; BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext, const wchar_t *text) ; Sets editable text contents. The AccessibleContext must implement AccessibleEditableText and be editable. The maximum text length that can be set is MAX_STRING_SIZE - 1. Returns whether successful. ; AccessibleContext $ac Func __setTextContents($vmId, $ac, $text) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "setTextContents", "long", $vmId, $c_JOBJECT64, $ac, "wstr", $text) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;========================================Accessible Table Functions========================================================= ;~ BOOL getAccessibleTableInfo(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) ; Returns information about the table, for example, caption, summary, row and column count, and the AccessibleTable. ; $tAccessibleTableInfo $tableInfo Func __getAccessibleTableInfo($vmId, $acParent, byref $tableInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTableInfo", "long", $vmId, $c_JOBJECT64, $acParent, "struct*", $tableInfo) If @error Then Return SetError(1, 0, 0) $tableInfo = $result[3] Return $result[0] EndFunc ;~ BOOL getAccessibleTableCellInfo(long vmID, AccessibleTable accessibleTable, jint row, jint column, AccessibleTableCellInfo *tableCellInfo) ; Returns information about the specified table cell. The row and column specifiers are zero-based. ; $tAccessibleTableCellInfo $tableCellInfo Func __getAccessibleTableCellInfo($vmId, $table, $row, $column, byref $tableCellInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTableCellInfo", "long", $vmId, $c_JOBJECT64, $table, "int", $row, "int", $column, "struct*", $tableCellInfo) If @error Then Return SetError(1, 0, 0) $tableCellInfo = $result[5] Return $result[0] EndFunc ;~ BOOL getAccessibleTableRowHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) ; Returns the table row headers of the specified table as a table. ; $tAccessibleTableInfo $tableInfo Func __getAccessibleTableRowHeader($vmId, $acParent, byref $tableInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTableRowHeader", "long", $vmId, $c_JOBJECT64, $acParent, "struct*", $tableInfo) If @error Then Return SetError(1, 0, 0) $tableInfo = $result[3] Return $result[0] EndFunc ;~ BOOL getAccessibleTableColumnHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) ; Returns the table column headers of the specified table as a table. ; $tAccessibleTableInfo $tableInfo Func __getAccessibleTableColumnHeader($vmId, $acParent, byref $tableInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTableColumnHeader", "long", $vmId, $c_JOBJECT64, $acParent, "struct*", $tableInfo) If @error Then Return SetError(1, 0, 0) $tableInfo = $result[3] Return $result[0] EndFunc ;~ AccessibleContext getAccessibleTableRowDescription(long vmID, AccessibleContext acParent, jint row) ; Returns the description of the specified row in the specified table. The row specifier is zero-based. Func __getAccessibleTableRowDescription($vmId, $acParent, $row) $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getAccessibleTableRowDescription", "long", $vmId, $c_JOBJECT64, $acParent, "int", $row) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ AccessibleContext getAccessibleTableColumnDescription(long vmID, AccessibleContext acParent, jint column) ; Returns the description of the specified column in the specified table. The column specifier is zero-based. Func __getAccessibleTableColumnDescription($vmId, $acParent, $column) $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getAccessibleTableColumnDescription", "long", $vmId, $c_JOBJECT64, $acParent, "int", $column) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; jint getAccessibleTableRowSelectionCount(long vmID, AccessibleTable table) ; Returns how many rows in the table are selected. Func __getAccessibleTableRowSelectionCount($vmId, $table) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getAccessibleTableRowSelectionCount", "long", $vmId, $c_JOBJECT64, $table) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; BOOL isAccessibleTableRowSelected(long vmID, AccessibleTable table, jint row) ; Returns true if the specified zero based row is selected. Func __isAccessibleTableRowSelected($vmId, $table, $row) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "isAccessibleTableRowSelected", "long", $vmId, $c_JOBJECT64, $table, "int", $row) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; BOOL getAccessibleTableRowSelections(long vmID, AccessibleTable table, jint count, jint *selections) ; Returns an array of zero based indices of the selected rows. Func __getAccessibleTableRowSelections($vmId, $table, $count, byref $selections) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTableRowSelections", "long", $vmId, $c_JOBJECT64, $table, "int", $count, "int*", $selections) If @error Then Return SetError(1, 0, 0) $selections = $result[4] Return $result[0] EndFunc ; jint getAccessibleTableColumnSelectionCount(long vmID, AccessibleTable table) ; Returns how many columns in the table are selected. Func __getAccessibleTableColumnSelectionCount($vmId, $table) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getAccessibleTableColumnSelectionCount", "long", $vmId, $c_JOBJECT64, $table) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; BOOL isAccessibleTableColumnSelected(long vmID, AccessibleTable table, jint column) ; Returns true if the specified zero based column is selected. Func __isAccessibleTableColumnSelected($vmId, $table, $column) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "isAccessibleTableColumnSelected", "long", $vmId, $c_JOBJECT64, $table, "int", $column) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; BOOL getAccessibleTableColumnSelections(long vmID, AccessibleTable table, jint count, jint *selections) ; Returns an array of zero based indices of the selected columns. Func __getAccessibleTableColumnSelections($vmId, $table, $count, byref $selections) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleTableColumnSelections", "long", $vmId, $c_JOBJECT64, $table, "int", $count, "int*", $selections) If @error Then Return SetError(1, 0, 0) $selections = $result[4] Return $result[0] EndFunc ;~ jint getAccessibleTableRow(long vmID, AccessibleTable table, jint index) ; Returns the row number of the cell at the specified cell index. The values are zero based. Func __getAccessibleTableRow($vmId, $table, $index) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getAccessibleTableRow", "long", $vmId, $c_JOBJECT64, $table, "int", $index) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ jint getAccessibleTableColumn(long vmID, AccessibleTable table, jint index) ; Returns the column number of the cell at the specified cell index. The values are zero based. Func __getAccessibleTableColumn($vmId, $table, $index) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getAccessibleTableColumn", "long", $vmId, $c_JOBJECT64, $table, "int", $index) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ jint getAccessibleTableIndex(long vmID, AccessibleTable table, jint row, jint column) ; Returns the index in the table of the specified row and column offset. The values are zero based. Func __getAccessibleTableIndex($vmId, $table, $row, $column) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getAccessibleTableIndex", "long", $vmId, $c_JOBJECT64, $table, "int", $row, "int", $column) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;========================================Accessible Relation Set Function========================================================= ;~ BOOL getAccessibleRelationSet(long vmID, AccessibleContext accessibleContext, AccessibleRelationSetInfo *relationSetInfo) ; Returns information about an object's related objects. ; $tAccessibleRelationInfo $relationSetInfo Func __getAccessibleRelationSet($vmId, $ac, byref $relationSetInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleRelationSet", "long", $vmId, $c_JOBJECT64, $ac, "struct*", $relationSetInfo) If @error Then Return SetError(1, 0, 0) $relationSetInfo = $result[3] Return $result[0] EndFunc ;========================================Accessible Hypertext Functions========================================================= ; BOOL getAccessibleHypertext(long vmID, AccessibleContext accessibleContext, AccessibleHypertextInfo *hypertextInfo) ; Returns hypertext information associated with a component. ; $tAccessibleHyperlinkInfo $hypertextInfo Func __getAccessibleHypertext($vmId, $ac, byref $hypertextInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleHypertext", "long", $vmId, $c_JOBJECT64, $ac, "struct*", $hypertextInfo) If @error Then Return SetError(1, 0, 0) $hypertextInfo = $result[3] Return $result[0] EndFunc ; BOOL activateAccessibleHyperlink(long vmID, AccessibleContext accessibleContext, AccessibleHyperlink accessibleHyperlink) ; Requests that a hyperlink be activated. Func __activateAccessibleHyperlink($vmId, $ac, $accessibleHyperlink) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "activateAccessibleHyperlink", "long", $vmId, $c_JOBJECT64, $ac, $c_JOBJECT64, $accessibleHyperlink) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; jint getAccessibleHyperlinkCount(const long vmID, const AccessibleHypertext hypertext) ; Returns the number of hyperlinks in a component. Maps to AccessibleHypertext.getLinkCount. Returns -1 on error. Func __getAccessibleHyperlinkCount($vmId, $hypertext) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getAccessibleHyperlinkCount", "long", $vmId, $c_JOBJECT64, $hypertext) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; BOOL getAccessibleHypertextExt(const long vmID, const AccessibleContext accessibleContext, const jint nStartIndex, AccessibleHypertextInfo *hypertextInfo) ; Iterates through the hyperlinks in a component. Returns hypertext information for a component starting at hyperlink index nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will be returned for each call to this method. Returns FALSE on error. ; $tAccessibleHyperlinkInfo $hypertextInfo Func __getAccessibleHypertextExt($vmId, $ac, $nStartIndex, byref $hypertextInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleHypertextExt", "long", $vmId, $c_JOBJECT64, $ac, "int", $nStartIndex, "struct*", $hypertextInfo) If @error Then Return SetError(1, 0, 0) $hypertextInfo = $result[4] Return $result[0] EndFunc ; jint getAccessibleHypertextLinkIndex(const long vmID, const AccessibleHypertext hypertext, const jint nIndex) ; Returns the index into an array of hyperlinks that is associated with a character index in document. Maps to AccessibleHypertext.getLinkIndex. Returns -1 on error. Func __getAccessibleHypertextLinkIndex($vmId, $hypertext, $nIndex) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getAccessibleHypertextLinkIndex", "long", $vmId, $c_JOBJECT64, $hypertext, "int", $nIndex) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; BOOL getAccessibleHyperlink(const long vmID, const AccessibleHypertext hypertext, const jint nIndex, AccessibleHypertextInfo *hyperlinkInfo) ; Returns the nth hyperlink in a document. Maps to AccessibleHypertext.getLink. Returns FALSE on error. ; $tAccessibleHyperlinkInfo $hypertextInfo Func __getAccessibleHyperlink($vmId, $hypertext, $nIndex, byref $hypertextInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleHyperlink", "long", $vmId, $c_JOBJECT64, $hypertext, "int", $nIndex, "struct*", $hypertextInfo) If @error Then Return SetError(1, 0, 0) $hypertextInfo = $result[4] Return $result[0] EndFunc ;========================================Accessible Key Binding Function========================================================= ;~ BOOL getAccessibleKeyBindings(long vmID, AccessibleContext accessibleContext, AccessibleKeyBindings *keyBindings) ; Returns a list of key bindings associated with a component. ; $tAccessibleKeyBindings $keyBindings Func __getAccessibleKeyBindings($vmId, $ac, byref $keyBindings) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleKeyBindings", "long", $vmId, $c_JOBJECT64, $ac, "struct*", $keyBindings) If @error Then Return SetError(1, 0, 0) $keyBindings = $result[3] Return $result[0] EndFunc ;========================================Accessible Icon Function========================================================= ; BOOL getAccessibleIcons(long vmID, AccessibleContext accessibleContext, AccessibleIcons *icons) ; Returns a list of icons associate with a component. ; $tAccessibleIconInfo $icons Func __getAccessibleIcons($vmId, $ac, byref $icons) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleIcons", "long", $vmId, $c_JOBJECT64, $ac, "struct*", $icons) If @error Then Return SetError(1, 0, 0) $icons = $result[3] Return $result[0] EndFunc ;========================================Accessible Action Functions========================================================= ;~ BOOL getAccessibleActions(long vmID, AccessibleContext accessibleContext, AccessibleActions *actions) ; Returns a list of actions that a component can perform. ; $tAccessibleActions $actions Func __getAccessibleActions($vmId, $ac, byref $actions) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getAccessibleActions", "long", $vmId, $c_JOBJECT64, $ac, "struct*", $actions) If @error Then Return SetError(1, 0, 0) $actions = $result[3] Return $result[0] EndFunc ;~ BOOL doAccessibleActions(long vmID, AccessibleContext accessibleContext, AccessibleActionsToDo *actionsToDo, jint *failure) ; Request that a list of AccessibleActions be performed by a component. ; $tAccessibleActionsToDo $actionsToDo Func __doAccessibleActions($vmId, $ac, byref $actionsToDo, byref $failure) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "doAccessibleActions", "long", $vmId, $c_JOBJECT64, $ac, "struct*", $actionsToDo, "int*", $failure) If @error Then Return SetError(1, 0, 0) $actionsToDo = $result[3] $failure = $result[4] Return $result[0] EndFunc ;========================================Utility Functions========================================================= ;~ BOOL IsSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2) ; Returns whether two object references refer to the same object. Func __isSameObject($vmId, $obj1, $obj2) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "isSameObject", "long", $vmId, $c_JOBJECT64, $obj1, $c_JOBJECT64, $obj2) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext, const wchar_t *role) ;Returns the AccessibleContext with the specified role that is the ancestor of a given object. The role is one of the role strings defined in Java Access Bridge API Data Stuctures. Func __getParentWithRole($vmId, $ac, $role) $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getParentWithRole", "long", $vmId, $c_JOBJECT64, $ac, "wstr", $role) If @error Then Return SetError(1, 0, 0) $role = $result[3] Return $result[0] EndFunc ; AccessibleContext getParentWithRoleElseRoot(const long vmID, const AccessibleContext accessibleContext, const wchar_t *role); ; Returns the AccessibleContext with the specified role that is the ancestor of a given object. If an object with the specified role does not exist, returns the top level object for the Java Window. Func __getParentWithRoleElseRoot($vmId, $ac, $role) $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getParentWithRoleElseRoot", "long", $vmId, $c_JOBJECT64, $ac, "wstr", $role) If @error Then Return SetError(1, 0, 0) $role = $result[3] Return $result[0] EndFunc ;~ AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext) ; Returns the AccessibleContext for the top level object in a Java window. Func __getTopLevelObject($vmId, $ac) $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getTopLevelObject", "long", $vmId, $c_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ int getObjectDepth (const long vmID, const AccessibleContext accessibleContext) ; Returns how deep in the object hierarchy a given object is. The top most object in the object hierarchy has an object depth of 0. Returns -1 on error. Func __getObjectDepth($vmId, $ac) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getObjectDepth", "long", $vmId, $c_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext) ; Returns the AccessibleContext of the current ActiveDescendent of an object. This method assumes the ActiveDescendent is the component that is currently selected in a container object. Func __getActiveDescendent($vmId, $ac) $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getActiveDescendent", "long", $vmId, $c_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ BOOL requestFocus(const long vmID, const AccessibleContext accessibleContext) ; Request focus for a component. Returns whether successful. Func __requestFocus($vmId, $ac) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "requestFocus", "long", $vmId, $c_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;~ int getVisibleChildrenCount(const long vmID, const AccessibleContext accessibleContext) ; Returns the number of visible children of a component. Returns -1 on error. Func __getVisibleChildrenCount($vmId, $ac) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getVisibleChildrenCount", "long", $vmId, $c_JOBJECT64, $ac) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; BOOL getVisibleChildren(const long vmID, const AccessibleContext accessibleContext, const int startIndex, VisibleChildrenInfo *visibleChildrenInfo); ; Gets the visible children of an AccessibleContext. Returns whether successful. ; $tVisibleChildenInfo $visibleChildrenInfo Func __getVisibleChildren($vmId, $ac, $startIndex, byref $visibleChildrenInfo) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getVisibleChildren", "long", $vmId, $c_JOBJECT64, $ac, "int", $startIndex, "struct*", $visibleChildrenInfo) If @error Then Return SetError(1, 0, 0) $visibleChildrenInfo = $result[4] Return $result[0] EndFunc ; int getEventsWaiting() ; Gets the number of events waiting to fire. Func __getEventsWaiting() $result = DllCall($hAccessBridgeDll, "int:cdecl", "getEventsWaiting") If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ;========================================Accessible Value Functions========================================================= ;~ BOOL GetCurrentAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len) Func __getCurrentAccessibleValueFromContext($vmId, $av, $value, $len) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getCurrentAccessibleValueFromContext", "long", $vmId, $c_JOBJECT64, $av, "wstr", $value, "short", $len) If @error Then Return SetError(1, 0, 0) $value = $result[3] Return $result[0] EndFunc ; BOOL GetMaximumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_ *value, short len) Func __getMaximumAccessibleValueFromContext($vmId, $av, $value, $len) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getMaximumAccessibleValueFromContext", "long", $vmId, $c_JOBJECT64, $av, "wstr", $value, "short", $len) If @error Then Return SetError(1, 0, 0) $value = $result[3] Return $result[0] EndFunc ; BOOL GetMinimumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_ *value, short len) Func __getMinimumAccessibleValueFromContext($vmId, $av, $value, $len) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "getMinimumAccessibleValueFromContext", "long", $vmId, $c_JOBJECT64, $av, "wstr", $value, "short", $len) If @error Then Return SetError(1, 0, 0) $value = $result[3] Return $result[0] EndFunc ;========================================Accessible Selection Functions========================================================= ; void AddAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) Func __addAccessibleSelectionFromContext($vmId, $as, $i) $result = DllCall($hAccessBridgeDll, "NONE", "addAccessibleSelectionFromContext", "long", $vmId, $c_JOBJECT64, $as, "int", $i) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; void ClearAccessibleSelectionFromContext(long vmID, AccessibleSelection as) Func __clearAccessibleSelectionFromContext($vmId, $as) $result = DllCall($hAccessBridgeDll, "NONE", "clearAccessibleSelectionFromContext", "long", $vmId, $c_JOBJECT64, $as) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; jobject GetAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) Func __getAccessibleSelectionFromContext($vmId, $as, $i) $result = DllCall($hAccessBridgeDll, "ptr:cdecl", "getAccessibleSelectionFromContext", "long", $vmId, $c_JOBJECT64, $as, "int", $i) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; int GetAccessibleSelectionCountFromContext(long vmID, AccessibleSelection as) Func __getAccessibleSelectionCountFromContext($vmId, $as) $result = DllCall($hAccessBridgeDll, "int:cdecl", "getAccessibleSelectionCountFromContext", "long", $vmId, $c_JOBJECT64, $as) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; BOOL IsAccessibleChildSelectedFromContext(long vmID, AccessibleSelection as, int i) Func __isAccessibleChildSelectedFromContext($vmId, $as, $i) $result = DllCall($hAccessBridgeDll, "bool:cdecl", "isAccessibleChildSelectedFromContext", "long", $vmId, $c_JOBJECT64, $as, "int", $i) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; void RemoveAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) Func __removeAccessibleSelectionFromContext($vmId, $as, $i) $result = DllCall($hAccessBridgeDll, "NONE", "removeAccessibleSelectionFromContext", "long", $vmId, $c_JOBJECT64, $as, "int", $i) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc ; void SelectAllAccessibleSelectionFromContext(long vmID, AccessibleSelection as) Func __selectAllAccessibleSelectionFromContext($vmId, $as) $result = DllCall($hAccessBridgeDll, "NONE", "selectAllAccessibleSelectionFromContext", "long", $vmId, $c_JOBJECT64, $as) If @error Then Return SetError(1, 0, 0) Return $result[0] EndFunc
    1 point
×
×
  • Create New...