Jump to content

fablecao

Members
  • Posts

    18
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

fablecao's Achievements

Seeker

Seeker (1/7)

5

Reputation

  1. It's a pity that SciTE-Lite doesn't support autoit3wrapper.keywords.properties and other properties.
  2. Oh, my God. It's the bug of SciTE-Lite, this setting takes no effect in SciTE-Lite.
  3. #AutoIt3Wrapper_UseX64 = y
  4. How to use autoit3_x64.exe in SciTE?
  5. Oh, maybe there is something wrong in my JAB native function. "NONE" should be changed to "NONE:cdecl". All of which should be corrected. 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
  6. By the way, I prefer to use the combination of JAB native function to write UDF. The JAB native function __requestFocus may implement your function highlightAC. ;~ 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
  7. I don't know what behaves weird when you use _JAB_SingleAction on the sitelist button. I test it successfully in my computer. And from your output of printDescription($siteListButton), I find that the output of printdescription($siteListButton) inside highlightAC is different from the next output of printdescription($siteListButton). Does the func clickSiteButton function normal? Does the func __releaseJavaObject inside highlightAC release the AC?
  8. _JAB_getAccessibleContextByRole($vmId, $ac, $sRole, 1) This function is not my original, you find wrong $re_ac which cause _JAB_singleAction error. You can use _JAB_getAccessibleContextByFindAll($vmId, $ac, $sName, $sRole)
  9. ;=====================================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] This is the usage of action in Java access bridge. $tagAccessibleActionInfo is a Java element's action's name, 256 byte max. $tagAccessibleActions is a structure of Java element's can-do actions, 256 members max, first member is total actions count. $tagAccessibleActionsToDo is a structure of Java element's to-do actions, 32 queue actions max, first member is total actionsToDo count. You find actions from can-do list, and put them into to-do list, and execute native interface function. $failure is used to put the execution result. __doAccessibleActions($vmId, $ac, $actionsToDo, $failure)
  10. setvalue example: 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 Java access bridge native interface function __setTextContents can do this. Due to some bug of early version of JRE, this native function takes no effect. So I wrote an alternative function. 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 Structure $actionsToDo, first member is actions count "2", second member is first action "select-all", third member is second action "paste-from-clipboard".
  11. Func _JAB_getName($vmId, $ac)    Local $acInfo = DllStructCreate($tagAccessibleContextInfo)    __getAccessibleContextInfo($vmId, $ac, $acInfo)    Return DllStructGetData($acInfo, "name") EndFunc
  12. One JAVA program has one vmID, every element in this program has its own ac (accessible context). You can manipulate an element by vmID and its unique ac. Function __getAccessibleContextFromHWND can acquire vmID and ac from a window’s handle. Before use this handle, you must use function __isJavaWindow to check whether it is or not a java window. And then, you can use its unique combination of name and role to find an element's ac by functon _JAB_getAccessibleContextByFindAll.
  13. global $wintitle = "Java Control Panel" $winHandle = WinActivate($wintitle) $result = __isJavaWindow($winHandle) Global $vmId Global $ac global $sName = "Edit Site List..." global $sRole = "push button" __getAccessibleContextFromHWND($winHandle, $vmID, $ac) $re_ac = _JAB_getAccessibleContextByFindAll($vmId, $ac, $sName, $sRole) _JAB_singleAction($vmId, $re_ac)
  14. Access Bridge Explorer is a Windows application that allows exploring, as well as interacting with, the Accessibility tree of any Java applications that uses the Java Access Bridge to expose their accessibility features Access Bridge Explorer provides features similar to the Java Ferret and Java Monkey sample applications that were distributed as part of the Java Access Bridge SDK when it was still distributed as a stand alone download. The Access Bridge Explorer application requires Windows 7 or later .NET 4.0 or later A version of the Java JRE/JDK that contains the Java Access Bridge, e.g. Java SE Runtime Environment (JRE) Release 7 Update 6 (7u6) and later. It also works with earlier versions if the standalone Java Access Bridge SDK has been installed. https://github.com/google/access-bridge-explorer In my .au3, the _JAB functions are examples in themselves. Function _JAB_setValue demonstrates how to use actions: create structure actions, get actionsCount, find two useful actions, create structure actionsToDo, put actionsCount and two actions into this structure, execute the actions. If an ac has only one action such as button click, you can use _JAB_singleAction.
  15. My English is not so good. My code is written according to the Java Access Bridge Interface strictly. The Oracle official Document is not detailed enough. So the struct definition is written according to AccessBridgePackages.h, the data definition and function definition is written according to AccessBridgeCalls.h. If you installed accessbridge2_0_2, you will find these two files in src/include directory. During these two parts of coding , the data type conversion is the most confusing work. Firstly, according to AccessBridgeCalls.h, all these data type are same. In Autoit, it is "UINT64". 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; Secondly, how to definite a struct in struct. The C interface code: ****************************************************** * AccessibleAction packages ****************************************************** */ #define MAX_ACTION_INFO 256 #define MAX_ACTIONS_TO_DO 32 // an action assocated with a component typedef struct AccessibleActionInfoTag { wchar_t name[SHORT_STRING_SIZE]; // action name } AccessibleActionInfo; // all of the actions associated with a component typedef struct AccessibleActionsTag { jint actionsCount; // number of actions AccessibleActionInfo actionInfo[MAX_ACTION_INFO]; // the action information } AccessibleActions; // struct for requesting the actions associated with a component typedef struct GetAccessibleActionsPackageTag { long vmID; JOBJECT64 accessibleContext; // the component AccessibleActions rAccessibleActions; // the actions } GetAccessibleActionsPackage; // list of AccessibleActions to do typedef struct AccessibleActionsToDoTag { jint actionsCount; // number of actions to do AccessibleActionInfo actions[MAX_ACTIONS_TO_DO];// the accessible actions to do } AccessibleActionsToDo; // struct for sending an message to do one or more actions typedef struct DoAccessibleActionsPackageTag { long vmID; // the virtual machine ID JOBJECT64 accessibleContext; // component to do the action AccessibleActionsToDo actionsToDo;// the accessible actions to do BOOL rResult; // action return value jint failure; // index of action that failed if rResult is FALSE } DoAccessibleActionsPackage; We just need to implement three of them in Autoit: ;=====================================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] Thirdly, how to set the data type in DllCall function. If it returns an object, you should use "ptr:cdecl". If the variable is kind of struct such as 'AccessibleContextInfo *info', you should use '"struct*", $info'. If the variable is string such as 'wchar_t *text', you should use '"wstr", $text'. Because in C, a string is an array of char, you must use it's pointer to access it. In the middle of the code, I write some _JAB function to implement some frequently used functions. The most important function is: 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 Due to the lacking of element searching tools in java element tree, I write this recursive function.
×
×
  • Create New...