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

help needed getting 2nd last line of text


  • Subject: help needed getting 2nd last line of text
  • From: Brian Christmas <email@hidden>
  • Date: Sat, 15 Dec 2012 19:11:46 +1100

G'day scripters

An asoc project.

I've been asked to insert a bar code into my list of Clients, so have changed from a text field to an NSTextView

I need to remove and replace the second last line in the field if the mail processes ok, but cant work out how to do it. I can insert the appropriate text ok, but the removal has me stumped.

The line to remove is "If this remains visible, then this job did not process correctly."

The line has to stay there if something goes wrong, but replaced if everything processes ok.

Any ideas or guidance please?

Regards

Santa


tell current application's NSFont to set myFont to fontWithName_size_("Cochin", 14)
 tell current application's NSColorList to set AppleColors to colorListNamed_("Apple")
 set someColor to AppleColors's colorWithKey_("Black")
 set attrsDict to current application's NSDictionary's dictionaryWithObjects_forKeys_({myFont,someColor}, {current application's NSFontAttributeName, current application's NSForegroundColorAttributeName})
 set theText to "Email is from : " & theSendersFullName &  linefeed &"Subject is : " & theSubject&linefeed&"Count of attachments is : " & attachmentCount&linefeed&"Printed at " & (actualDate as text) & " Local time."&linefeed&"Which is " & actualDate - (time to GMT) & " Universal time."&linefeed&"If this remains visible, then this job did not process correctly."&linefeed
 tell current application's NSAttributedString to set newText to alloc()'s initWithString_attributes_(theText, attrsDict)
 set textStorage to textView's textStorage()
 -- append new text
 tell textStorage to appendAttributedString_(newText)

 set someColor to AppleColors's colorWithKey_("Blue")
 set attrsDict to current application's NSDictionary's dictionaryWithObjects_forKeys_({myFont,someColor}, {current application's NSFontAttributeName, current application's NSForegroundColorAttributeName})
 set theText to "---------------------------------------------------------------------------------------------------"&linefeed
 tell current application's NSAttributedString to set newText to alloc()'s initWithString_attributes_(theText, attrsDict)
 set textStorage to textView's textStorage()
 -- append new text
 tell textStorage to appendAttributedString_(newText)

 _______________________________________________
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: Shane Stanley <email@hidden>
  • Prev by Date: Re: Getting PowerPoint Slide Info
  • Next by Date: Re: help needed getting 2nd last line of text
  • Previous by thread: Re: Getting PowerPoint Slide Info
  • Next by thread: Re: help needed getting 2nd last line of text
  • Index(es):
    • Date
    • Thread