Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7921751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:42:11+00:00 2026-06-03T16:42:11+00:00

After reading the question Programmatically select text range in TextEdit , I am curious

  • 0

After reading the question “Programmatically select text range in TextEdit”, I am curious why the AXSelectedTextRange attribute can’t be set in AppleScript even though the properties indicate it is settable.

Open a TextEdit document, type a few lines, highlight a portion and run the script below to test.

activate application "TextEdit"
tell application "System Events"
    set attr to attribute "AXSelectedTextRange" of text area 1 of scroll area 1 of window "Untitled" of application process "TextEdit"
    attr's properties -- determine if settable
    set attr's value to {1, 2}
    delay 1
    attr's value
end tell

Is there something different about how AppleScript handles accessibility attributes that I am misssing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:42:13+00:00Added an answer on June 3, 2026 at 4:42 pm

    Because the requested class (an NSValue that contains an object of class NSRange [or CFRange in Carbon]) does not exist in AppleScript. The class list in AppleScript equals the class NSArray in Objective-C.

    Another example:

    set value of attribute "AXPosition" of window 1 of application process "TextEdit" to {30, 30}
    

    does nothing because the value must be an NSPoint.

    When getting an attribute value in AppleScript, “System Events” converts NSRange, NSpoint, NSSize or NSRect to an NSArray that contains numbers (an AppleScript list), but does not convert a list to these types when you want to set the value.

    • In NSAccessibility Protocol Reference: NSAccessibilitySelectedTextRangeAttribute : The range of selected text (NSValue). The class NSValue may contain an object among these classes (NSRange, NSpoint, NSSize or NSRect)

    • In Carbon Accessibility Reference: kAXSelectedTextRangeAttribute : CFTypeRef : The range of the currently selected text (start & end character positions). This attribute is usually settable. The value is an encoded CFRange structure.

    So it is possible in Objective-C, AppleScriptObjC or any other language that can use the Cocoa or Carbon API, like UI Browser – but not in AppleScript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

after reading this question i wonder if someone can help me understand how to
After reading this question , i saw the answer by Naveen containing a link
(I realize that my title is poor. If after reading the question you have
Please read my update at the end of question after reading the answers: I'm
After reading and commenting on this question PHP Library for Keeping your site index
After reading a description about swapping pointer addresses on Stackoverflow, I have a question
i have a question, after allot of hours in googling and reading articles, i
This seems to be an embarrassingly simple question, but, after a day of reading
After reading a question on @private I understand how that works. However, since all
After reading this question I attempted to clean out my workspace and found that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.