Code: Select all
$txt = Read Selection
Find "^.*$txt.*\n", 'Ea'
Code: Select all
$txt = Read Selection
Find "^.*$txt.*\n", 'Ea'
Because the find expression in your macro has adopted the attributes of your macro file. You need something like this:js wrote:But this does not work. Why is this?
Code: Select all
$exp = Cast to String '^.*'
$exp &= Read Selection
$exp2 = Cast to String '.*\n'
$exp &= Cast to Attributed String $exp2
Find All $exp, 'Eu-i'
Yes, being very careful of the attributes is crucial. Beware any stray attributes, including the paragraph style. In most cases Normal tends to be applied.Kino wrote:Because the find expression in your macro has adopted the attributes of your macro file.
I've seen Kino's feedback, and NWP can indeed fail to find all attribute-sensitive matches using js's expression. That said, there's more than one way to skin a cat. Alternative strategy:It does not always work fine. Even a corresponding manual operation fails at times. I just sent them a feedback.
Code: Select all
$exp = Read Selection
Find All $exp, 'u-i'
Menu 'Select:Select Paragraph'