• 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: help needed getting 2nd last line of text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help needed getting 2nd last line of text


  • Subject: Re: help needed getting 2nd last line of text
  • From: Shane Stanley <email@hidden>
  • Date: Sun, 16 Dec 2012 11:25:39 +1100

On 16/12/2012, at 9:10 AM, Brian Christmas <email@hidden> wrote:

> I've tried
>
>   set textStorage to textView's textStorage()
>     -- append new text
>     set newTextLength to textStorage's  |length|() as integer
>     say 6
>      set theRange  to textstorage's replaceOccurrencesOfString_withString_options_range_(linefeed,linefeed,0,{0,newTextLength-1})  #backwardsSearch
>     say theRange
>
> to try and get the count of linefeeds, but it doesn't work. Any ideas please anyone?

textStorage and textstorage are two different things, although the error may disappear as it gets compiled -- it's hard to know. This is another reason why you should edit your AS code in an external editor rather than directly in Xcode. You probably also need to add "as integer" to coerce the result from an NSNumber to an integer. (And that's not a backwards search, not that it matters.)

--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>


 _______________________________________________
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: help needed getting 2nd last line of text
      • From: Brian Christmas <email@hidden>
References: 
 >help needed getting 2nd last line of text (From: Brian Christmas <email@hidden>)
 >Re: help needed getting 2nd last line of text (From: Shane Stanley <email@hidden>)
 >Re: help needed getting 2nd last line of text (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: help needed getting 2nd last line of text
  • Next by Date: Re: help needed getting 2nd last line of text
  • Previous by thread: Re: help needed getting 2nd last line of text
  • Next by thread: Re: help needed getting 2nd last line of text
  • Index(es):
    • Date
    • Thread