MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

processing notebook selections with buttons

  • To: mathgroup at
  • Subject: [mg86326] processing notebook selections with buttons
  • From: Hannes Kessler <HannesKessler at>
  • Date: Sat, 8 Mar 2008 05:43:52 -0500 (EST)


how is it possible use a selection more than once in the Button-
function? Here are two Button examples to clarify my question:

 Button["Use selection 1",
  With[{  m = CurrentValue  @  NotebookSelection  @
SelectedNotebook[]  },
   NotebookApply[  SelectedNotebook[], "\[SelectionPlaceholder]" <>
"\n" <> ToString@m]]],
 Button["Use selection 2",
  With[{m = "\[SelectionPlaceholder]"},
   NotebookApply[  SelectedNotebook[], m <> "\n" <> m]]]

The output are following two buttons:
{Use selection 1,Use selection 2}

Write and select something in a new input cell, for example

Push button 1 and get

Push button 2 and get

What I would like to get, however, is

So again, how can I get the notebook selection into a pushed Button
for repeated processing?

Thanks in advance,
Hannes Kessler

  • Prev by Date: Re: Methods for plotting
  • Next by Date: symbolize in v.6
  • Previous by thread: Re: ListCorrelate and functions on it with an extra condition
  • Next by thread: symbolize in v.6