Re: Convert to Expression
- To: mathgroup at smc.vnet.net
- Subject: [mg86479] Re: Convert to Expression
- From: Albert Retey <awnl at arcor.net>
- Date: Wed, 12 Mar 2008 00:13:13 -0500 (EST)
- References: <fr5e6d$obc$1@smc.vnet.net>
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