toolkit = msf.createInstance("com.sun.star.awt.Toolkit");
} catch (com.sun.star.uno.Exception e) {
e.printStackTrace( System.err );
}
XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, toolkit);
shortWait();
Object atw = tk.getActiveTopWindow();
XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw);
XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
XAccessibleContext ARoot = AccessibilityTools.getAccessibleObjectForRole(xRoot,
AccessibleRole.MENU_BAR);
XAccessibleSelection sel = UnoRuntime.queryInterface(XAccessibleSelection.class, ARoot);
for (int k = 0; k < indexes.length; k++) {
try {
sel.selectAccessibleChild(indexes[k]);
shortWait();
ARoot = ARoot.getAccessibleChild(indexes[k])
.getAccessibleContext();
sel = UnoRuntime.queryInterface(XAccessibleSelection.class, ARoot);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
}
}
shortWait();
atw = tk.getActiveTopWindow();
xWindow = UnoRuntime.queryInterface(XWindow.class, atw);
xRoot = AccessibilityTools.getAccessibleObject(xWindow);
//at.printAccessibleTree(new PrintWriter(System.out),xRoot);
XAccessibleAction action = UnoRuntime.queryInterface(XAccessibleAction.class, AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, bName));
try {
action.doAccessibleAction(0);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
}
shortWait();
atw = tk.getActiveTopWindow();
xWindow = UnoRuntime.queryInterface(XWindow.class, atw);
xRoot = AccessibilityTools.getAccessibleObject(xWindow);