|
[Date Index]
[Thread Index]
[Author Index]
Extracting the contents of tagged cells as plain text
- To: mathgroup at smc.vnet.net
- Subject: [mg86321] Extracting the contents of tagged cells as plain text
- From: "J. McKenzie Alexander" <jalex at lse.ac.uk>
- Date: Sat, 8 Mar 2008 05:42:55 -0500 (EST)
Hello,
Suppose that I have a number of cells in a notebook containing program
code written in a language other than Mathematica. (Like Java or C.)
I'd like to be able to extract the contents of these cells as plain
text for processing in Mathematica (as strings), and then ultimately
export to a .java file for later compiling.
Suppose that each cell has the tag "java". I know that I can select
the cells in the current notebook with that tag by calling
NotebookLocate["java"]
but, once I've done this, how do I get the contents of each cell? The
only thing I've found to work, so far, is:
NotebookLocate["java"];
(First[List @@ #] &) /@ NotebookRead[InputNotebook[]]
but this looks like a bit of a hack, and I keep thinking that there
has to be a more elegant way. Is there?
Sorry for such a basic question, but I'm just starting to learn how to
manipulate the contents of notebooks programmatically, and am
stumbling in the dark a bit.
Many thanks,
Jason
--
Dr J. McKenzie Alexander
Department of Philosophy, Logic and Scientific Method
London School of Economics and Political Science
Houghton Street, London WC2A 2AE
Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm
Prev by Date:
Re: Methods for plotting
Next by Date:
Re: changing style of vertices for ShowGraph with Combinatorica
Previous by thread:
Re: symbolize in v.6
Next by thread:
Re: Extracting the contents of tagged cells as plain text
|