NISUS Archives

April 2013

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Philip Spaelti <[log in to unmask]>
Reply To:
Date:
Mon, 22 Apr 2013 17:15:02 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (47 lines)
Hello Nobumi,

I am sure one could do something more elegant, but here is a macro that gives the basic idea. Unfortunately Nisus current macro implementation of working with styles etc. is a bit roundabout, so this ends up a bit more complicated than I would like:

$sel = TextSelection.active
$text = $sel.text
$attr = $text.displayAttributesAtIndex $sel.location
$color = $attr.textColor
$findExpr = ".+"
Push Target Text $findExpr
Set Text Color $color
Find and Replace $findExpr,'\0','!Eau'
Edit:Find:Show Find…

So if you select a bit of text and run this you should have ".+" in the find box with the color from the selection. Note however that you could just as easily write a macro that wouldn't bother with the find box at all, and just directly create a formatted find expression. Also you could look at some of Kino's macros that show how to select all bits with the same style.

And of course the easiest for selecting bits with the same color is to use the pop-up in the status bar at the bottom of the window.

Best
Philip


On 21. Apr 2013, at 22:54 , Nobumi Iyanaga wrote:

> Hello,
> 
> I would like to write a macro that will do a wildcard search based on a text color. Here is the situation that needs such a macro. I am doing editing work, using different text colors (for example RED when I add something, BLUE when I wand to delete something, etc.). I can search all the RED text using the attribute sensitive PowerFind Pro search, setting ".+" in the Find box, and applying RED from the Text Color menu. All this is very fine.
> 
> But when I receive texts that were edited by others, with text colors, that will not work like this. As they use some other word processor (mostly MS Word), the colors that they use most often do not correspond with a defined color in the Text Color menu in Nisus Writer Pro. So, I cannot use the Text Color menu to apply the needed color to my ".+".
> 
> It is possible to enter a character in a specific color in the Find box (selecting this character and pressing Command + E), and overwrite this character in the Find box to ".+", then check the "Attribute Sensitive" check box. This works in general, but the entered character contains for example the Paragraph Style attribute, so that this will find only the colored text in the same paragraph style.
> 
> So, what I would like to have is a macro that copies in the Find box the find pattern ".+", in which only the color attribute of the selected character(s) is inherited. I think this should not be impossible, but as I have never used color related commands in the macro language, I would like to be helped by more knowledgeable people.
> 
> By the way, I think other macros of the same kind may be made easily, based on such a macro: for example a macro for the wildcard search based on a specific font, or other specific style attributes.
> 
> Thank you very much in advance.
> 
> Best regard,
> 
> Nobumi Iyanaga
> Tokyo,
> Japan

Philip Spaelti
[log in to unmask]

ATOM RSS1 RSS2