Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

processing notebook selections with buttons

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

Hello,

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
aaa

Push button 1 and get
aaa
$Failed

Push button 2 and get
aaa
\[SelectionPlaceholder]

What I would like to get, however, is
aaa
aaa

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