• 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: FastScripts and script editor discrepancies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FastScripts and script editor discrepancies


  • Subject: Re: FastScripts and script editor discrepancies
  • From: Shane Stanley <email@hidden>
  • Date: Thu, 03 Nov 2016 11:23:15 +1100

You could also try replacing this:

-- make attributed string system font with monospaced digits
set fontSize to current application's NSFont's systemFontSizeForControlSize:(current application's NSRegularControlSize)
set theFont to current application's NSFont's monospacedDigitSystemFontOfSize:fontSize weight:(current application's NSFontWeightRegular)
set attsDict to current application's NSDictionary's dictionaryWithObject:theFont forKey:(current application's NSFontAttributeName)
set attString to current application's NSAttributedString's alloc()'s initWithString:theMessage attributes:attsDict

with something like this:

-- make attributed string system font with monospaced digits
set fontSize to current application's NSFont's systemFontSizeForControlSize:(current application's NSRegularControlSize)
set theFont to current application's NSFont's systemFontOfSize:fontSize weight:(current application's NSFontWeightRegular)
set monoFont to current application's NSFont's monospacedDigitSystemFontOfSize:fontSize weight:(current application's NSFontWeightRegular)
set attsDict to current application's NSDictionary's dictionaryWithObject:theFont forKey:(current application's NSFontAttributeName)
set attString to current application's NSMutableAttributedString's alloc()'s initWithString:theMessage attributes:attsDict
set theRegex to current application's NSRegularExpression's regularExpressionWithPattern:"(\\t| )(\\d+)(\\t|\\n| )" options:0 |error|:(missing value)
set theMatches to theRegex's matchesInString:(attString's |string|()) options:0 range:{0, attString's |length|()}
repeat with aMatch in theMatches
set theRange to (aMatch's rangeAtIndex:2)
(attString's addAttribute:(current application's NSFontAttributeName) value:monoFont range:theRange)
end repeat

That's just going to change the font of numerical columns.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


 _______________________________________________
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: 
 >Re: FastScripts and script editor discrepancies (From: Phil Stokes <email@hidden>)

  • Prev by Date: Re: FastScripts and script editor discrepancies
  • Next by Date: Re: FastScripts and script editor discrepancies
  • Previous by thread: Re: FastScripts and script editor discrepancies
  • Next by thread: nil in AppleScript
  • Index(es):
    • Date
    • Thread