Re: help needed getting 2nd last line of text
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