Select a webview using applescript in an application - applescript

I'm using Applescript to open an application, said application has a webview. I'm trying to select only the webview. Structure of the application appears below. The "Hello" portion is the webview I want to select. I was trying 'UI element 9' but it appears sometimes the app opens and re-orders the controls. In the below iamge, I want the control whose text is 'Hello', which is a WebView.
I would like in the following script to know how to replace UI element 9 with web view 1 or something similar. I just don't know the way to target the webview element.
set i to scroll area 1 of UI element 9 of splitter group 1 of the front window

Looking for Applescript dictionary, I can't find 'web view', but only following UI elements :
browsers, busy indicators, buttons, checkboxes, color wells, columns, combo boxes, drawers, groups, grow areas, images, incrementors, lists, menus, menu bars, menu bar items, menu buttons, menu items, outlines, pop overs, pop up buttons, progress indicators, radio buttons, radio groups, relevance indicators, rows, scroll areas, scroll bars, sheets, sliders, splitters, splitter groups, static texts, tab groups, tables, text areas, text fields, toolbars, UI elements, value indicators, windows.
You can also call/refer to UI element by its name (if any) like :
click menu "File" of menu bar 1
instead of
click menu 3 of menu bar 1
(third menu is usually File menu, after "Apple" and "application")
However, it could be that your application did not defined a name for the relevant UI Element, then only index can be used !

Related

How to create dropdown splitted button (like Mail.app)?

Mail.app at Mac OS have cool dropdown buttons at toolbars. It is not simple dropdown button, that button is splitted to 2 parts (button and dropdown list). How can I create such type of button with menu so it have 2 actions (menu and click)?
Button:
Menu:
I assume Apple uses a NSSegmentedControl object there. One for the flag, one for the arrow.
To replicate this behavior, add a segmentedControl in Interface Builder with two segments and set its Mode to Momentary.
Then add your images or titles and set the width of the second segment to an appropriate value.
This was my quick outcome:

Kendo Grid keyboard navigation

Lets say I have a list of 1000 items and I am trying to navigate through the grid using keyboard arrows UP/DOWN.When I reach the last item on the page the keyboard DOWN arrow doesn't load the next items in the grid. This is the code.
Thanks

How to make a scrolling bar of buttons (buttons bar) with Cocoa?

I would like to have buttons inside a scroll view (or another solution to creating a scrollable button bar).
I have buttons placed side by side in a row along the top of a view. As a user resizes the window to be less wide, fewer buttons can be seen.
When all the buttons cannot be viewed, I would like the user to still be able to access all the buttons by scrolling horizontally through them.
To visualise this, imagine in Safari if you open too many tabs to fit in the window - I would like the user to be able to scroll to the right and reveal the tabs that weren't on the screen.
You need to deselect the springs (for the custom view of the scroller) in the autosizing setter so that the view doesn't shrink along with the scroll view when you resize.

How do I build a toolbar in my title bar?

I have to implement a custom toolbar for my application, where a button will be placed on the side of exit, maximize and minimize buttons.
I tried to work with the toolbar element on XCode, but it always put elements below these buttons and not on the side.
App Store application implement this feature, like you can see in this image.
One solution is to start with this open source code (https://github.com/indragiek/INAppStoreWindow) to give you the correct title bar style, and then position buttons in the titlebar.

How to require explicit dismissal of a yui popup menu?

I have a page with a couple of widgets on it, each of which, when clicked, brings up a yui popup menu: If I click on widget 1, its menu comes up. If I now click on widget 2, widget 1's menu gets a hide event, and widget 2's menu gets a show event and comes up. I'd like to change this so that, when widget 1's menu is up, it must be explicitly dismissed by a click on the page background (and/or, perhaps, another click on the widget or the escape key) before the menu attached to widget 2 is allowed to appear.
I've set up some beforeShowEvent and beforeHideEvent handlers on the menus, hoping to be able to use some method (a global variable? ick) of keeping track of when a menu is present and showing or hiding accordingly, but it's not working -- these handlers can't tell the difference between a click on the page background and a click on widget 2 (at least, not as I've done it so far). Is there any way to do what I'm trying to do? Thanks!
I think that a combination of clicktohide: false
Boolean indicating if the Menu will automatically be hidden if the user clicks outside of it. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus.
and keepopen: true
Boolean indicating if the menu should remain open when clicked.
will take care of this.
http://developer.yahoo.com/yui/menu/#configref

Resources