• 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: Adam Morris <email@hidden>
  • Date: Wed, 26 Jan 2011 06:40:12 +0700

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

Thanks Michelle, and to Chris off-list; that same hint got me going,
the solution is the following:

-- "Move" the current selection over by one character
tell application "Pages"
	set sel to selection
	set {chr_offset, l} to {character offset, length} of sel
	set new_offset to chr_offset + 1

	-- Pages doesn't let you set character offset or length directly, so rebuild it
	set new_sel to a reference to text from character new_offset to
character (new_offset + l) of body text of front document
	select new_sel
end tell
 _______________________________________________
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

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