content of selection
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