Can I use variable as argument in action routine?

Tony Balinski ajbj at free.fr
Thu Oct 9 20:40:48 CEST 2008


Quoting "Paterline, David L." <paterldl at westinghouse.com>:

> 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?

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


More information about the Discuss mailing list