Here is another much better macro by
Kino that does exactly what the OP asked for. I'm not sure whether it belongs to the macros that originally come with NWP. I hope it is not redundant. Therefore I post it here. It's called
"SelectSameOrOtherColor".
### Select Same or Different Color ###
# Select all text portions having or not having the same color as that of the insertion point.
# If the insertion point is at the very end of a text object, the macro uses Typing Attributes, which may not coincide with what the user expects.
Require Pro Version 1.2
$doc = Document.active
$sel = TextSelection.active
if $sel == undefined
exit
elsif $sel.location == $sel.text.length
$attr = $sel.displayTypingAttributes
else
$attr = $sel.text.displayAttributesAtIndex $sel.location
end
$activeColor = $attr.textColor
$sameColor = $otherColors = Array.new
foreach $text in $doc.allTexts
if $text.length
$i = 0
while $i < $text.length
$attr = $text.displayAttributesAtIndex $i
$range = $text.rangeOfDisplayAttributesAtIndex $i
$sel = TextSelection.new $text, $range
if $attr.textColor == $activeColor
$sameColor.appendValue $sel
else
$otherColors.appendValue $sel
end
$i = $range.bound
end
end
end
$same = 'Same Color'
$other = 'Other Colors'
$color = Prompt 'Select text portions in...', '', $same, $other
if $color == $same
$doc.setSelections $sameColor
else
$doc.setSelections $otherColors
end
### end of macro ###