Page 1 of 1

Getting a pop-up window for a paragraph

Posted: 2021-01-28 03:59:41
by pereelmagne
Hello,
I want to invoke a pop-up window for a selected paragraph. Just that. I don't want to do anything with said paragraph, only display it. My macro is like this:

Select Paragraph
$selection = TextSelection.active
Show Find Results $selection, "Selected paragraph"

Can anyone tell me what's wrong?

Re: Getting a pop-up window for a paragraph

Posted: 2021-01-28 06:23:08
by phspaelti
Hi pereelmagne,

The Show Find Results command expects as argument a Hash where the key(s) have arrays of selection objects as values.
So you could modify your code as follows:

Code: Select all

Select Paragraph
$selection = TextSelection.active
$matches = Hash.new 'Selected Paragraph', Array.new($selection)
Show Find Results $matches
Try it and have a look at the result.

I just suspect that a better choice for what you are trying to achieve would be:

Code: Select all

$sel = Read Selection
prompt 'Selected Paragraph', $sel

Re: Getting a pop-up window for a paragraph

Posted: 2021-01-28 06:40:04
by phspaelti
Actually the following would also work, but the result(s) display a bit different:

Code: Select all

$doc = Document.active
Show Find Results $doc.textSelections, 'Selected Paragraphs'

Re: Getting a pop-up window for a paragraph

Posted: 2021-01-28 09:21:39
by pereelmagne
Thank you very much.
All three solutions work well. I will keep all them in my notes.

Best wishes,
Pere

Re: Getting a pop-up window for a paragraph

Posted: 2021-01-30 05:27:25
by phspaelti
A belated follow up about a Nisus feature that I had forgotten about. Nisus has a command "Edit > Select > Show Selection in Results Window", which would also achieve the desired effect.