• 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
Re: getting reference as string for rebuilding a reference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting reference as string for rebuilding a reference


  • Subject: Re: getting reference as string for rebuilding a reference
  • From: Michelle Steiner <email@hidden>
  • Date: Mon, 24 Jan 2011 23:10:47 -0700

On Jan 24, 2011, at 9:01 PM, Adam Morris wrote:

Hi there applescripters,

I'm scripting Pages, and the "get selection" gives me a reference like this:

text from character 44 to character 49 of body text of document id
1706710 of application "Pages"

What I want to do is calculate a new selection (say, from character
start_char to character end_char) based on that first, given,
selection.

tell application "Pages"
set sel to the selection
{character offset, length} of sel
end tell

That will give you the location from the beginning of the document of the first character of the selection, and the length of the selection.  The arithmetic should be obvious.

-- Michelle

-- 
"No" is not a bad word.

 _______________________________________________
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

References: 
 >getting reference as string for rebuilding a reference (From: Adam Morris <email@hidden>)

  • Prev by Date: getting reference as string for rebuilding a reference
  • Next by Date: Is Image Disk Trash Empty?
  • Previous by thread: getting reference as string for rebuilding a reference
  • Next by thread: Re: getting reference as string for rebuilding a reference
  • Index(es):
    • Date
    • Thread