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

Where are the sample macros?
https://www.nisus.com/forum/viewtopic.php?f=17&t=2115
Page 1 of 1

Author:  js [ 2007-04-12 15:19:49 ]
Post subject:  Where are the sample macros?

I tried a simple macro, like this

$my_text = Read Selection
Find $my_text, a

without the "a" at the end it works as expected: The selected text is picked up and a Find Next is executed.
After reading the manual I expected that adding ", a" would do a Find All. Why does this not work?

Also I wonder where to find the sample macros indicted in the manual. When I opened Pro first, I found my original macro file from Express.

Author:  martin [ 2007-04-12 15:44:24 ]
Post subject:  Re: Where are the sample macros?

js wrote:
I tried a simple macro, like this

$my_text = Read Selection
Find $my_text, a

without the "a" at the end it works as expected: The selected text is picked up and a Find Next is executed.
After reading the manual I expected that adding ", a" would do a Find All. Why does this not work?

The Find statement takes two arguments. Each of these arguments needs to be something that yields a string value (a sequence of letters). The value of the variable $my_text is a string, specifically the selection you assigned it earlier. The letter a is however nothing that yields a value. What the macro language requires is that you tell it you want a string containing the letter a. You do this by enclosing it in quotation marks.

To review, the following are all valid macros:
Quote:
Find "whatever"

Quote:
Find "whatever", "a"

Quote:
$text = "whatever"
Find $text

Quote:
$text = "whatever"
Find $text, "a"

Quote:
$text = "whatever"
$options = "a"
Find $text, $options

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