GUI Scripting bug with text ranges
GUI Scripting bug with text ranges
- Subject: GUI Scripting bug with text ranges
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 21 Mar 2017 07:16:21 -0400
When I attempt to get the 'value of attribute "AXSelectedTextRange"' using a TextEdit file as my target, I receive a return value showing the start and end index numbers of the current selection. When I try to set the value of the attribute (which is marked as settable), nothing happens no matter what values I provide -- the selection does not change. This appears to be happening in other applications, too -- specifically, Microsoft Word which I tested, and FileMaker Pro Advanced which a customer tested.
I am running the latest versions of everything on the latest hardware, namely macOS Sierra 10.12.3 on a MacBook Pro (Late 2016) with TouchID.
This appears to be a bug in the System Events application, not in Apple's Accessibility API. I know this because my UI Browser application correctly gets and sets the selected text range of TextEdit and Word.
Has anybody else seen this? Found any workarounds?
(As a separate issue, my testing also showed me that GUI Scripting returns a selected text range consisting of the start and end index numbers of the selection, not the start index number and the range of the selection as the underlying Accessibility API attribute does. I see from an example in the Second Edition of Matt Neuburg's "AppleScript: The Definitive Guide" that this has been the case for many years, maybe since the beginning. This is of course entirely consistent with standard AppleScript's use of start and end boundaries for all manner of ranges, such as 'text 7 thru 19 of myText'. But it's embarrassing for me, since my UI Browser incorrectly tells users to compose the settable text range as {<start>, <range>} in conformity with the underlying Accessibility API.) |
_______________________________________________
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