• 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
Requesting even <more> assistance with terminology, please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Requesting even <more> assistance with terminology, please


  • Subject: Requesting even <more> assistance with terminology, please
  • From: Brian Christmas <email@hidden>
  • Date: Thu, 25 Sep 2014 08:36:06 +1000

G'day yet again.

This is a real PITA!

I've tried to read an NSColor of an Attributed character, but the code won't allow the read. I thought from the documentation  that the character might be immutable, so decided to try and convert it to a mutable Attributed charter, and  simply cannot get he conversion from the very vague explanation of the creation of a CF character, to Applescript.

Am I on the wrong track? Explored is extremely brief on conversions as far as I can find, and there does not seem to be anything on the net.

I'd appreciate a conversion from…

CFAttributedStringCreateMutableCopy

Creates a mutable copy of an attributed string.

CFMutableAttributedStringRef CFAttributedStringCreateMutableCopy (
   CFAllocatorRef alloc,
   CFIndex maxLength,
   CFAttributedStringRef aStr
);
Parameters
alloc
The allocator to be used to allocate memory for the new attributed string. Pass NULL or kCFAllocatorDefault to use the current default allocator.
maxLength
The limit on the length of the new attributed string. The string starts empty and can grow to this length (it can be shorter).
Pass 0 to specify that the maximum length is not limited. If non-0, maxLength must be greater than or equal to the length of aStr.
aStr
The attributed string to copy.
Return Value
A mutable copy of aStr. Ownership follows the Create Rule.
Availability
  • Available in OS X v10.4 and later.
Declared In
CFAttributedString.h



to ApplescriptObjC please (I haven't the foggiest idea on how to pass NULL or kCFAllocatorDefault to whatever), so that might be the problem), or, why have they mentioned maxLength but not CFIndex? Do they want a range? There's simply too many possible permutations for me not to request help.

Also, why won't Explored's 'set aMutableCopyOfItemForAttributes to itemForAttributes's mutableCopy()' method  work?

Regards

Santa




set itemForAttributes to theVariedAttributedText's attributedSubstringFromRange_({1 as integer, 1 as integer})
#
set p to 1.4
#
# The following two lines can be used to double-check that we've actually selected an alpha-numeric character, not a linefeed
#
set theItemAsString to itemForAttributes's |string|() #<= 'N'
#display dialog theItemAsString as text
#
say 4
# 
# I tried this from 'Explored', but no go
#
#set aMutableCopyOfItemForAttributes to itemForAttributes's mutableCopy()
#
# Cannot get terminology correct
#
set aMutableCopyOfItemForAttributes to alloc's CFAttributedStringCreateMutableCopy_maxLength_(itemForAttributes, 1 as integer)
#
say 5
set colorAccess to current application's NSForegroundColorAttributeName # <= 'NSColor'
set p to 1.5
say 6
#display dialog colorAccess as text 
say 6.1
set theAttributedTextItemsKeys to aMutableCopyOfItemForAttributes's allKeys() as list
say 6.5
display dialog theAttributedTextItemsKeys as text
#
set myFontColor to aMutableCopyOfItemForAttributes's objectForKey_(colorAccess)
#


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: can't get terminology right
  • Next by Date: Requesting even <more> assistance with terminology, please (an update)
  • Previous by thread: Re: can't get terminology right
  • Next by thread: Requesting even <more> assistance with terminology, please (an update)
  • Index(es):
    • Date
    • Thread