• 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
content of selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

content of selection


  • Subject: content of selection
  • From: Thomas Fischer <email@hidden>
  • Date: Thu, 15 Oct 2009 15:38:18 +0200

Hello,

I am new to this mailing list, and did not find an answer to my problem searching the archives.
So please excuse me if it is there somewhere and I missed it.


I'm trying to get at selected text in the "AppleScript Editor" and don't see how to get it.
To pinpoint some of the problems I use the following script:


tell application "AppleScript Editor"
	tell document "AdobeTest.scpt"
		set theSelection to the selection
		set myText to characters 289 thru 303
		set myText to the contents of theSelection
	end tell
end tell

This gives the result:

tell application "AppleScript Editor"
get selection of document "AdobeTest.scpt"
--> characters 289 thru 303 of document "AdobeTest.scpt"
get characters 289 thru 303 of document "AdobeTest.scpt"
--> {"\t", "t", "e", "l", "l", " ", "w", "i", "n", "d", "o", "w", " ", "1", "\r"}
get characters 289 thru 303 of document "AdobeTest.scpt"
--> error number -1720 from characters 289 thru 303 of document "AdobeTest.scpt"
Ergebnis:
error "„AppleScript Editor“ hat einen Fehler erhalten: Ungültiger Bereich."
number -1720 from characters 289 thru 303 of document "AdobeTest.scpt"
(„AppleScript Editor“ received an error: Invalid range.", I suppose)


I find it confusing that the call
get characters 289 thru 303 of document "AdobeTest.scpt"
gives the correct result when sent as
"set myText to characters 289 thru 303 as text"
and an error when given as
"set myText to the theSelection as text"

Has anybody any suggestions?

All the best
Thomas

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: content of selection
      • From: "email@hidden" <email@hidden>
  • Prev by Date: Re: AS apps in sidebar don't accept drag and drop input in SL
  • Next by Date: Re: content of selection
  • Previous by thread: Re: SatImage Regular Expression OSAX error
  • Next by thread: Re: content of selection
  • Index(es):
    • Date
    • Thread