• 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: Text and Offset Peculiarities ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text and Offset Peculiarities ???


  • Subject: Re: Text and Offset Peculiarities ???
  • From: KOENIG Yvan <email@hidden>
  • Date: Sun, 15 May 2011 20:02:27 +0200


Le 15 mai 2011 à 19:46, Michael D Mays a écrit :

I have this script

tell application "Safari"
set myText to the text of document 1
set myOffset to offset of " Departing 0" in myText
set myAscii to ASCII number (text (myOffset - 1) of myText)
set myOffset to offset of (ASCII character myAscii) & " Departing 0" in myText
end tell

The first offset command finds a match >1 but I run it the result  (second offset command) is 0 ???

ASCII character myAscii is 63. When I look at myText in the replies pane of AppleScript Editor what I see is
/n Departing
If I say 
  set myOffset to offset of  "/n Departing 0" in myText
the result is 0.

Any ideas as to what is happening or what I am doing wrong?


Hello

For see, I ran this script :

set myText to "blahblah
 aaa? Departing 0 buzzzzzz
"

set myOffset to offset of " Departing 0" in myText
log myOffset
set myAscii to ASCII number (text (myOffset - 1) of myText)
log myAscii
set myOffset to offset of (ASCII character myAscii) & " Departing 0" in myText
log myOffset

The login report was :

tell current application
offset of " Departing 0" in "blahblah
 aaa? Departing 0 buzzzzzz

"
15
(*15*)
ASCII number "?"
63
(*63*)
ASCII character 63
"?"
offset of "? Departing 0" in "blahblah
 aaa? Departing 0 buzzzzzz

"
14
(*14*)
end tell

Which is the normal behavior.

Yvan KOENIG (VALLAURIS, France) 15 mai 2011 20:02:03


 _______________________________________________
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: 
 >Text and Offset Peculiarities ??? (From: Michael D Mays <email@hidden>)

  • Prev by Date: Text and Offset Peculiarities ???
  • Next by Date: Re: Text and Offset Peculiarities ???
  • Previous by thread: Text and Offset Peculiarities ???
  • Next by thread: Re: Text and Offset Peculiarities ???
  • Index(es):
    • Date
    • Thread