How to change default action in Find Nearby Words.nwm–Solved

Get help using and writing Nisus Writer Pro macros.
Post Reply
User avatar
CrisB
Posts: 122
Joined: 2006-09-25 10:30:11
Location: Gibraltar, Europe
Contact:

How to change default action in Find Nearby Words.nwm–Solved

Post by CrisB »

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
Find Nearby Words.nwm
This macro finds any paragraph which contains two specified words in any order
(22.19 KiB) Downloaded 698 times
Last edited by CrisB on 2013-10-18 22:16:18, edited 2 times in total.
Find strategies to improve your effectiveness at http://www.lifestrategies.net
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: How to change default action in Find Nearby Words.nwm

Post by martin »

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: Select all

$button = Prompt 'What should be done with those words?', '', 'Set In Find Panel', 'Find All'
The first label is for the default button.
User avatar
CrisB
Posts: 122
Joined: 2006-09-25 10:30:11
Location: Gibraltar, Europe
Contact:

Re: How to change default action in Find Nearby Words.nwm

Post by CrisB »

Brilliant, it works perfectly...

thanks a million, Cris :-)
Find strategies to improve your effectiveness at http://www.lifestrategies.net
User avatar
CrisB
Posts: 122
Joined: 2006-09-25 10:30:11
Location: Gibraltar, Europe
Contact:

Re: How to change default action in Find Nearby Words.nwm–So

Post by CrisB »

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

Cris
Attachments
Find Nearby Words.nwm
This macro finds only paragraphs that contain both of two desired whole word matches.
(23.05 KiB) Downloaded 681 times
Find strategies to improve your effectiveness at http://www.lifestrategies.net
Post Reply