• 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: Can I speed up Mail content setting?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I speed up Mail content setting?


  • Subject: Re: Can I speed up Mail content setting?
  • From: Brian Christmas <email@hidden>
  • Date: Fri, 29 May 2015 20:32:15 +1000

G’day again Shane

I’m afraid I’ve struck another problem.

I’m trying to set the characteristics of a range of text that varies from Email to Email.

I think I’ve got the method correct for determining the start and end of the text, but can’t seem to format it into a range.

Snippets of some of my code are below.

Any advice again, please?

Regards

Santa

PS Should this now be in the ASObjC list?



The error is…

Second Main eMailIt error unable to set argument 4 - the AppleScript value <NSAppleEventDescriptor: 'utxt'("{88,0}")> could not be coerced to type {_NSRange=QQ}. number -10000 p = 62.3


-- do regex search for runs of the first ending offset
set p to 34
set firstEndOffSetRegex to current application's NSRegularExpression's regularExpressionWithPattern:("Total Mail items processed+") options:0 |error|:(missing value)
set p to 35
set firstEndOffSetMatches to (firstEndOffSetRegex's matchesInString:anNSString options:0 range:{0, theFullLength}) as list
set p to 36
repeat with i from 1 to count of firstEndOffSetMatches
set theFirstOffSetEndOfRange to location of (item 1 of firstEndOffSetMatches)'s range()
set theFirstOffSetEndOfRange to theFirstOffSetEndOfRange - 3
end repeat
if (count of firstEndOffSetMatches) = 0 then set theFirstOffSetEndOfRange to 0
say (count of firstEndOffSetMatches)
say theFirstOffSetEndOfRange as text
-- do regex search for runs of hour reports
set p to 45
set xx to count of ((my hourCutOff) & " Report" as text)
set p to 46
set hourReportRegex to current application's NSRegularExpression's regularExpressionWithPattern:((my hourCutOff) & " Report+” as text ) options:0 |error|:(missing value)
set p to 47
set hourReportMatches to (hourReportRegex's matchesInString:anNSString options:0 range:{0, theFullLength}) as list
-- make changes to "Daily Report" Report
set p to 62
repeat with i from 1 to count of hourReportMatches
set p to 62.1
# The text string to alter is always the first found
  set theRangeStart to location of (item 1 of hourReportMatches)'s range()
set p to 62.2
set theRange to "{" & theRangeStart & "," & theFirstOffSetEndOfRange & "}" as text
set p to 62.3
(anNSMutableAttributedString's addAttribute:(current application's NSFontAttributeName) value:theReportFont range:theRange)
set p to 62.4
(anNSMutableAttributedString's addAttribute:(current application's NSForegroundColorAttributeName) value:theReportColor range:theRange)
end repeat




 _______________________________________________
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: Can I speed up Mail content setting?
      • From: Shane Stanley <email@hidden>
References: 
 >Can I speed up Mail content setting? (From: Brian Christmas <email@hidden>)
 >Re: Can I speed up Mail content setting? (From: Shane Stanley <email@hidden>)
 >Re: Can I speed up Mail content setting? (From: Brian Christmas <email@hidden>)
 >Re: Can I speed up Mail content setting? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Can I speed up Mail content setting?
  • Next by Date: Re: Can I speed up Mail content setting?
  • Previous by thread: Re: Can I speed up Mail content setting?
  • Next by thread: Re: Can I speed up Mail content setting?
  • Index(es):
    • Date
    • Thread