Re: UI scripting...
Re: UI scripting...
- Subject: Re: UI scripting...
- From: Yvan KOENIG <email@hidden>
- Date: Sun, 10 Jan 2016 10:10:27 +0100
> Le 2016/01/10 à 09:57, Jean-Christophe Helary <email@hidden> a écrit :
>
> I'm using UIElementInspector to navigate a Java application.
>
> I'm stuck when I want to set the value of a text field from Script Editor, when I can do it from UIElementInspector...
>
> The UI structure is the following:
>
> <AXApplication: “OmegaT”>
> <AXWindow: “プロジェクトの検索”>
> <AXComboBox>
> <AXTextField>
>
> Attributes:
> AXSelectedTextRange (W): “pos=0 len=18”
> AXNumberOfCharacters: “18”
> AXEnabled: “1”
> AXParent: “<AXComboBox>”
> AXSize: “w=729 h=28”
> AXFocused (W): “1”
> AXRole: “AXTextField”
> AXTopLevelUIElement: “<AXWindow: “プロジェクトの検索”>”
> AXInsertionPointLineNumber: “0”
> AXHelp: “(null)”
> AXPosition: “x=84 y=48”
> AXTitle: “(null)”
> AXWindow: “<AXWindow: “プロジェクトの検索”>”
> AXRoleDescription: “テキストフィールド”
> AXValue (W): “SSID : KAGAWA-WiFi”
> AXVisibleCharacterRange: “pos=0 len=18”
> AXSelectedText (W): “SSID : KAGAWA-WiFi”
> AXFrame: “x=84 y=48 w=729 h=28”
>
> What I do is try to set the value of the Search field once the Search is called. First, I've identified the text field and a "get value" gives me the value identified in AXValue and AXSelectedText above.
>
> Now, in UIElementInspector I can go to the AXSelectedText (W) attribute (btw, would this W thing mean "writable" ?) and I can change the value there and it is reflected in the application (on a side note, I cannot change the AXValue attribute...)
>
> But when I want to do the same thing from AS, I miserably fail and the following code returns the original value...
>
> tell application "System Events"
> tell process "OmegaT"
> set frontmost to "true"
> click menu item 18 of menu 4 of menu bar 1
> delay 0.5
> set value of text field 1 of combo box 1 of window 1 to {{"essai"}}
> get value of text field 1 of combo box 1 of window 1
> end tell
> end tell
>
> I've also been looking for a thorough reference on how to use UI scripting, any pointer ?
>
> Thank you all in advance.
>
> Jean-Christophe
Hello Jean-Christophe
I don't know the application OmegaT but I would edit one instruction as :
set value of text field 1 of combo box 1 of window 1 to "essai"
The value of a text field is supposed to be a string, not a list of lists of strings.
Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) dimanche 10 janvier 2016 10:10:23
_______________________________________________
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