Discussion:
Can I use variable as argument in action routine?
Paterline, David L.
2008-10-09 18:16:03 UTC
Permalink
I'm trying to write a little macro to delete all occurrences of selected text in a file. Something simple like:

$selected = get_selection()
replace_all("$selected", "", "literal")

I've tried a number of variations of this with no luck.

I seem to be getting the selection OK, but the replace_all routine seems to be using the string $selected, rather than the value of the current selection substituted for the variable $selected.

Should I be able to use a macro variable for an argument in an action routine?

Thanks in advance.

-
David L. Paterline
Principal Engineer
Nuclear Fuel Engineering
Methods and Reload Tools

Westinghouse Electric Company
Westinghouse Energy Center E-468
Monroeville, PA 15146 USA
Phone: +1 (412) 374-2286
Fax: +1 (412) 374-2284
Email: paterldl-***@public.gmane.org
Home Page: http://www.westinghousenuclear.com
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Tony Balinski
2008-10-09 18:40:48 UTC
Permalink
Post by Paterline, David L.
I'm trying to write a little macro to delete all occurrences of selected
$selected = get_selection()
replace_all("$selected", "", "literal")
I've tried a number of variations of this with no luck.
I seem to be getting the selection OK, but the replace_all routine seems to
be using the string $selected, rather than the value of the current
selection substituted for the variable $selected.
Should I be able to use a macro variable for an argument in an action routine?
Looks like the second line should be
replace_all($selected, "", "literal")
ie, no quotes around the first argument.
(Dollar variables aren't like shell ones - they're just global)

Tony
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Paterline, David L.
2008-10-10 18:36:26 UTC
Permalink
Great! Thanks.

-
David L. Paterline
Principal Engineer
Nuclear Fuel Engineering
Methods and Reload Tools

Westinghouse Electric Company
Westinghouse Energy Center E-468
Monroeville, PA 15146 USA
Phone: +1 (412) 374-2286
Fax: +1 (412) 374-2284
Email: paterldl-***@public.gmane.org
Home Page: http://www.westinghousenuclear.com


-----Original Message-----
From: discuss-bounces-***@public.gmane.org [mailto:discuss-bounces-***@public.gmane.org] On Behalf Of Tony Balinski
Sent: Thursday, October 09, 2008 2:41 PM
To: General NEdit discussion list
Subject: Re: Can I use variable as argument in action routine?
Post by Paterline, David L.
I'm trying to write a little macro to delete all occurrences of selected
$selected = get_selection()
replace_all("$selected", "", "literal")
I've tried a number of variations of this with no luck.
I seem to be getting the selection OK, but the replace_all routine seems to
be using the string $selected, rather than the value of the current
selection substituted for the variable $selected.
Should I be able to use a macro variable for an argument in an action routine?
Looks like the second line should be
replace_all($selected, "", "literal")
ie, no quotes around the first argument.
(Dollar variables aren't like shell ones - they're just global)

Tony
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Continue reading on narkive:
Loading...