Re: UI scripting...
Re: UI scripting...
- Subject: Re: UI scripting...
- From: David Gregg <email@hidden>
- Date: Sun, 10 Jan 2016 23:35:48 -0700
> On Jan 10, 2016, at 5:40 PM, Jean-Christophe Helary <email@hidden> wrote:
>
> Well, I tried to select the application as indicated in the manual but it never appeared in Target. It may be because I installed UI Browser a little while ago without using it (I remember deleting it a few weeks ago) and the 30 days being over I don't have access to that part. But I do have access to the Screen Reader.
I am able to set the app as a Target in UI Browser.
However, you can't access that text field, only its parents which include the combo box.
If you assume that the search field is the first active element on that window when it opens, then you can use a simple keystroke command to enter the search criteria. I believe that is a good assumption although it needs further checking.
I prefer to use repeat loops instead of delays whenever possible, delay is unreliable in the later versions of OS X.
If there are keyboard shortcuts available I generally prefer to use them over menu item commands as they are less dependent on language and menu bar structure.
You could change the name of the window from "Text Search" to suit your language requirements. I used the name/title of the window instead of "1" because the latter would not work with the repeat loop method of delay, although it would work with the tell block.
Depending on your other needs it looked like most of the other GUI elements were accessible through UI Browser and could be added to the handler if you prefer a more complete workflow.
set searchCriteria to "essai"
doSearchOmegaT(searchCriteria)
on doSearchOmegaT(searchCriteria)
tell application "System Events"
tell process "OmegaT"
set frontmost to "true"
repeat until exists menu bar item "OmegaT" of menu bar 1
end repeat
keystroke "f" using command down -- Search Project… command keyboard shortcut
repeat until exists window "Text Search"
end repeat
tell window "Text Search"
keystroke searchCriteria -- assume that search field is first active field on window
delay 0.1
get value of text field 1 of combo box 1
end tell
end tell
end tell
end doSearchOmegaT
> Would that explain why I can change a text field value with UIElementInspector but not with Script Editor ?
Yes...
>
> Jean-Christophe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden