nisus.com
https://www.nisus.com/forum/

How to change default action in Find Nearby Words.nwm–Solved
https://www.nisus.com/forum/viewtopic.php?f=17&t=5493
Page 1 of 1

Author:  CrisB [ 2013-10-18 08:54:58 ]
Post subject:  How to change default action in Find Nearby Words.nwm–Solved

Hi, I find the attached Find Nearby Words macro very, very useful - thanks again Martin.

Yet I always want the expression put into the Find panel, so I can modify it later if needed.

How do I modify this section so the default action changes and the expression, by default, goes into the Find panel?

# ask user what to do
$button = Prompt 'What should be done with those words?', '', 'Find All', 'Set In Find Panel'
$expression = "$first(AnyTextCharacter)(1+ Shortest)$second(Or)$second(AnyTextCharacter)(1+ Shortest)$first"
If $button == 'Set In Find Panel'
Write Find Expression $expression
Show Find
Exit
End

Thanks for your help,
Cris

Attachments:
File comment: This macro finds any paragraph which contains two specified words in any order
Find Nearby Words.nwm [22.19 KiB]
Downloaded 176 times

Author:  martin [ 2013-10-18 14:37:09 ]
Post subject:  Re: How to change default action in Find Nearby Words.nwm

CrisB wrote:
Hi, I find the attached Find Nearby Words macro very, very useful - thanks again Martin.

Yet I always want the expression put into the Find panel, so I can modify it later if needed.

How do I modify this section so the default action changes and the expression, by default, goes into the Find panel?

That's not difficult, just switch the order of the button labels in the Prompt command, eg:
Code:
$button = Prompt 'What should be done with those words?', '', 'Set In Find Panel', 'Find All'

The first label is for the default button.

Author:  CrisB [ 2013-10-18 22:13:06 ]
Post subject:  Re: How to change default action in Find Nearby Words.nwm

Brilliant, it works perfectly...

thanks a million, Cris :-)

Author:  CrisB [ 2013-10-20 11:56:46 ]
Post subject:  Re: How to change default action in Find Nearby Words.nwm–So

Guess I should have attached the latest version of this macro...

Cris

Attachments:
File comment: This macro finds only paragraphs that contain both of two desired whole word matches.
Find Nearby Words.nwm [23.05 KiB]
Downloaded 162 times

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/