Hello Philip and Žorvaršur,
Thank you very much for your replies.
On Apr 22, 2013, at 5:15 PM, Philip Spaelti <[log in to unmask]> wrote:
> 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
Ah, that seems very intelligent. What I did not know was the two lines:
> Push Target Text $findExpr
> Set Text Color $color
I will try to put this in a macro (perhaps after some time, because I am just now terribly busy...). If I can get something working, I will let you know.
>
> 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.
Yes, but the search with the Find box being interactive, it has often a flexibility that automatic search would not have...
> Also you could look at some of Kino's macros that show how to select all bits with the same style.
Yes, certainly.
>
> 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.
I did not know that at all. In fact, I have not payed enough attention to these small icons at the bottom of the window. I will try to have better look at them.
Thank you very much again!
Best regard,
Nobumi Iyanaga
Tokyo,
Japan
|