Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7207
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.chainon-marquant.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!nx02.iad01.newshosting.com!newshosting.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail |
|---|---|
| From | A Retey <awnl@gmx-topmail.de> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to run ".nb" file always in dos command line |
| Date | Wed, 14 Dec 2011 11:10:37 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <jca07d$a3q$1@smc.vnet.net> (permalink) |
| References | <jc4pan$cfa$1@smc.vnet.net> <jc7aui$p27$1@smc.vnet.net> |
| Lines | 40 |
| NNTP-Posting-Date | 14 Dec 2011 10:15:20 GMT |
| NNTP-Posting-Host | cb295ad7.news.twtelecom.net |
| X-Trace | DXC=K^f?D>idSM84c1ZETcjjP3C_A=>8kQj6==_1NR_H?JP=;T8l36j_JW?EFiONJ7[Go6PPU\P:F:Qj8 |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:7207 |
Show key headers only | View raw
Hi,
> You can evaluate your notebook from the command line with a
> procedure such as this.
>
> Assuming your working directory is C:\temp\plot demo
>
> create a text file C:\temp\plot demo\runplot.m containing this:
>
>
> Needs["JLink`"];
> $FrontEndLaunchCommand = "Mathematica.exe";
> UseFrontEnd[
> selected = Select[Notebooks[],
> CurrentValue[#, NotebookFileName] === "1.nb"&];
> If[selected != {},
> targetnotebook = First@selected;
> SelectionMove[targetnotebook, All, Notebook];
> SelectionEvaluate[targetnotebook];
> ];
> Exit[]];
While I think the above should work, for version 8 it probably can be
achieved somewhat simpler with something along these lines:
UsingFrontEnd[
NotebookEvaluate[NotebookOpen["full/path/to/file.nb"]]
]
UsingFrontEnd was new in version 7 and seems to replace UseFrontEnd from
the JLink-Package without the need to explicitly load a package and
NotebookEvaluate is new in version 8 and has some additional options
with which one can control the details of the evaluation. See the
documentation for the three functions for more information...
hth,
albert
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to run ".nb" file always in dos command line wch <weichanghe2000@gmail.com> - 2011-12-12 11:42 +0000
Re: How to run ".nb" file always in dos command line Chris Degnen <degnen@cwgsy.net> - 2011-12-13 10:55 +0000
Re: How to run ".nb" file always in dos command line A Retey <awnl@gmx-topmail.de> - 2011-12-14 11:10 +0000
Re: How to run ".nb" file always in dos command line wch <weichanghe2000@gmail.com> - 2011-12-15 09:56 +0000
csiph-web