MathGroup Archive 2008

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

Search the Archive

Re: Convert to Expression


Namrata Khemka wrote:
> Hi everyone,
> I have a question regarding using "Show Expression".
> If you select a cell and then go to "Format" -> Show Expression.
> For  example:
> Plot[x, {x, 1, 3}]
> 
> Selecting the cell and going to format->Show Expression one gets:
> Cell[BoxData[
>      RowBox[{"Plot", "[",
>        RowBox[{"x", ",",
>          RowBox[{"{",
>            RowBox[{"x", ",", "1", ",", "3"}], "}"}]}],
>        "]"}]], "Input"]
> 
> 
> Is there a command to get this Expression that one can type in instead
> of using the menu bar?

If command means you are looking for how to get at that expression 
programmatically, you should look at NotebookRead. Here is a simple 
Button that prints the selected Cell(expression) in Outputform:

Button[
  "Print Cell Expression",
  Print[OutputForm[NotebookRead[ButtonNotebook[]]]]
  ]

To try it select a cell and press the button. For a usefull application 
you usually would need to set the selection first. Read about that in:

tutorial/ManipulatingNotebooksFromTheKernel


hth,

albert


  • Prev by Date: ResetMenusPacket
  • Next by Date: Re: Update 6.0.2
  • Previous by thread: Re: Convert to Expression
  • Next by thread: getting prints at desired scale