• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
GUI Scripting bug with text ranges
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.)

-- 

Bill Cheeseman - email@hidden

 _______________________________________________
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

  • Follow-Ups:
    • Re: GUI Scripting bug with text ranges
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: My script won't be running stably
  • Next by Date: Re: GUI Scripting bug with text ranges
  • Previous by thread: Re: My script won't be running stably
  • Next by thread: Re: GUI Scripting bug with text ranges
  • Index(es):
    • Date
    • Thread