For questions about MathematicaScript, or running the kernel without direct user interaction.

learn more… | top users | synonyms

15
votes
1answer
574 views

Why are all the lines commented when I create a Mathematica script?

When I created a Mathematica script, I found that all my lines were commented out (when opened with vi or gedit or any other ...
13
votes
3answers
740 views

Reading from STDIN, or: how to pipe data into Mathematica

Today I tried using Mathematica's plotting capabilities to display the output of a C++ program. This made me wonder whether it is possible to somehow tell a Mathematica script to read from STDIN and ...
13
votes
3answers
2k views

Mathematica script - passing command line arguments

When using Mathematica script #!/usr/local/bin/MathematicaScript -script Print[$ScriptCommandLine] and running it with some arguments: ...
11
votes
3answers
728 views

Why doesn't my script work when I redirect stdout?

I'm using Mathematica Home Edition 9.0.1 on Mac OS X 10.8.2. I have this script: ...
11
votes
1answer
433 views

Formatting and printing lists with Mathematica scripts

I'm just starting out with Mathematica and I'm using MathematicaScript rather than the GUI. However, I'm having trouble formatting a list when printing it. Suppose ...
10
votes
2answers
401 views

Simultaneously running the same .m file with different inputs

I have my Mathematica code in a .m file and I run it from the command line with some parameters. I was wondering, if there is no overlap in input and output files, ...
10
votes
1answer
373 views

Scheduling Mathematica scripts to run from a command line [duplicate]

I want to run Mathematica "jobs" on a daily/weekly basis to do system maintenance and as part of daily processing operations. What is the best way to do this?
10
votes
2answers
576 views

Evaluator option for Mathematica Scripts

I have mathematica with many additional kernels besides Local ( e.g., core1, core2, core3, core4 ... ) added through Kernel Configuration Options. I have been running multiple copies of a simulation ...
9
votes
2answers
2k views

Printing a string in a Mathematica script

Here's a simple script saved in the file hello #!/usr/local/bin/MathematicaScript -script Print["Hello world"] I can then run ...
7
votes
1answer
365 views

Launch a specific notebook automatically when Mathematica starts

I run Mathematica on an iMac running OS X 10.6.8. I have set the OS's "Launch Items" to include Mathematica so that the application opens when the computer boots. Now I want to go further and ...
6
votes
0answers
39 views

math.exe vs wolfram.exe vs MathKernel.exe vs WolframKernel.exe (running scripts on Windows)

I generally consider Mma documentation very good. However, it is startlingly difficult to find useful information on running Mma batch scripts, especially on Windows. So ... just what would I enter ...
5
votes
1answer
232 views

Mathematica scripting on Microsoft Windows

Is it possible to use Mathematica (or the Mathematica kernel) to interact with Microsoft Windows, much like any macro-based scripting language that controls the keyboard/mouse, opens/closes programs ...
5
votes
3answers
280 views

Executing Mathematica script from inside SQL Server

Does anyone have experience in calling Mathematica from inside SQL Server to do calculations? For example, how can I make a Procedure that uses Mathematica? Or a job that runs some Mathematica script? ...
5
votes
1answer
218 views

How to import non-text data from std input in a Mathematica script?

Or maybe a better question is - how can I get a stdin stream? I need to run on Linux. I did look at Reading from STDIN, or: how to pipe data into Mathematica, but ...
4
votes
2answers
163 views

Why does Mathematica stop when run in the background in command line mode?

If I try to start a Mathematica script in the background from the command line, like this: math -script someFile.m & then the process gets automatically ...
4
votes
2answers
327 views

How to automate Mathematica scripts? - I [duplicate]

I would like to use the Windows Task Scheduler, or Visual Cron, to start a Mathematica notebook or .m file to do some system maintenance tasks: copy files from one place to another, etc. How do I set ...
4
votes
1answer
121 views

Saving a source file adds (* ::Package:: *) to the first line

I am running Mathematica 9 on a linux machine and I've encountered the following behaviour that I am trying to understand. When I'm editing multiple source (.m) files using mathematica saving adds a ...
4
votes
1answer
348 views

Doubts on scripting: error messages when trying to run and how to process lots of files

I have created my first mathematica 'program' as I think of it, to do some image processing. After reading in an image, it does a lot of stuff (including smoothing, fourier transform, functional ...
4
votes
0answers
96 views

MathKernel with `-noprompt` hangs indefinitely when converting simple TeX expression

If I enter MathKernel -noprompt -run 'ToExpression["1", TeXForm]; Exit[]' the kernel hangs, apparently while running TeX.exe ...
3
votes
2answers
524 views

How to create an executable notebook in Mac OS X

All, I am looking for help to create a notebook to be executed via terminal in MAC OSX. The notebook uses the front end. This is what I have so far ...
3
votes
2answers
591 views

Is there a way to get user input when running a script on a Linux terminal?

I have access to a node of a Linux cluster, on which Mathematica is installed. However, I do not have access to a Linux GUI. Typically I write and test Mathematica scripts on my Windows personal ...
3
votes
1answer
371 views

Wolfram language from batch or py

I would like to automate the commands in this website into a batch file, so when the batch file it runs these commands in sequence. http://community.wolfram.com/groups/-/m/t/157461 Do any of you have ...
3
votes
1answer
101 views

How to start Mathematica kernel without loading init.m?

Is it possible to start Mathematica kernel from UNIX command line without having the init.m loaded, but not by simply deleting or commenting out it before hand? If this is a Mathematica script, is it ...
3
votes
1answer
111 views

How to catch an interrupt (Control-C) in a script?

If a user hits Control-C when a script is running, they get an Interrupt> prompt, where they have to type exit or ...
3
votes
3answers
244 views

Temporarily redirect the output of Print[ ] to a second file

I have started using Mathematica to automate file backup operations. The logistics I need make Mathematica a good choice. I am testing and developing the Notebook manually, and ...
3
votes
1answer
369 views

Interrupting package evaluation, handling error

I have some packages/scripts that I schedule the execution using Jobs in SQL server. For example, in some of then, I use to create reports and delivery by mail using Mathematica. All done using ...
3
votes
2answers
1k views

Command line execution of Mathematica notebooks and conversion to .m

Sometimes one may want to execute a notebook via the command line (for example to run it remotely). As far as I know it's not possible to run notebooks directly, but ...
3
votes
1answer
84 views

Is it possible to print more than last line with Get (<<) without using Print commands?

I want to run my Mathematica scripts from the terminal and I want it to print lines like MATLAB would. That is, suppress output by ending a line with ;, and ...
3
votes
0answers
136 views

How to batch run Mathematica code from Python?

I have this notebook: ...
3
votes
0answers
205 views

Accessing MathematicaScript over ssh/network

Here is the conundrum I am faced with. I have two computer. One with Mathematica (and hence MathematicaScript) but generally poor resources. The other without ...
2
votes
1answer
378 views

Running a shell script within Mathematica

The title pretty much explains it and I have not found something similar already posted. Perhaps I am not searching for the correct title or maybe this is something very basic, but I would appreciate ...
2
votes
1answer
172 views

Run kernel script in cygwin without window popping up

I'm calling mathematica scripts running kernels through a cygwin terminal, which are again executed from c++ code. When I do this a window pops up, prints warnings and errors if there are any, and ...
2
votes
1answer
224 views

Custom (Frame)Ticks fail when using Mathematica's script engine

I want to define my own ticks in a DateListPlot. It works quite well when I use the code in a Mathematica Notebook but breaks somehow when using it via ...
2
votes
0answers
52 views

Find where an error occurred in a bunch of command line scripts

I have been using my intuition to solve errors in my Mathematica scripts. But when calculations got more complex and I started getting errors involving code in more participating scripts (a script ...
2
votes
0answers
44 views

Session logging of “\$Echo” and “\$Output” in Mathematica 10

I have difficulties with session logging and Mathematica 10. In previous versions, you could simply use AppendTo[$Echo, logfile] and ...
2
votes
0answers
70 views

How to get information during evaluation of a Mathematica script?

I have a Mathematica script table=ParallelTable[f[u],{u,0,40,.5}] Export["filename.csv",table] that computes and exports a table of a rather complicated function ...
2
votes
0answers
46 views

How to ensure that command line variables are secure for MathKernel scripts?

Suppose I write a Mathematica script, called test.m, like the following: Print["Hello, World!"]; test = ToExpression[$CommandLine[[-1]]]; Print["I'm alive!"]; ...
1
vote
1answer
58 views

Write memory usage to file in script

Is there a way to write the MemoryInUse into a file once a minute? In this Debugging memory leaks question there is a neat dynamic diagram showing the MemoryInUse over time. My problem is that I run ...
1
vote
1answer
130 views

Mathematica script - Using front end

I'm running Mathematica on OS X and I want to create an Automator action that converts spreadsheet files. I have written this script: ...
1
vote
0answers
69 views

How to make Mathematica script executable? [closed]

I have the following Mathematica script ...
1
vote
0answers
189 views

Script with command line argument

As a test I want a simple script to take a command line argument and print it to a file: ...
0
votes
1answer
330 views

StringJoin/FileNameJoin doesn't quite work in script

My mathematica script is as follows: ...
0
votes
1answer
56 views

Mathematica on a cluster

I try to run mathematica on a grid. Since this is my first time working on a cluster, I have no plan what to do. I have to run a job (pbs-file). ...
0
votes
1answer
131 views
0
votes
1answer
87 views

How to record all the output (including error messages) of a mathematica script in a file?

Is it possible to record all the output of a Mathematica script to a file? I am looking for the Mathematica equivalent of ...
0
votes
1answer
118 views

Running a script Mathematica 9 [closed]

I am working in a Linux machine.The name of my mathematica file is deres.nb Code: a={}; AppendTo[a,1]; a>>"file" Now, if I run this code, by simply ...
0
votes
1answer
94 views

Possible to use Manipulate in GUIRunModal?

Is it possible to use the widget created by Manipulate within GUIRunModal? I intend to run the file using ...
0
votes
0answers
40 views

Needs entry point of a package from a Mathematica script

I am writing a bunch of Mathematica scripts to run command line in a HPC environment. I am organising my solution in small chunks I can test separately. So I have a directory structure like: ...
0
votes
0answers
47 views

When using NETLink, what is sufficient sanitization?

I am writing a webapp where I use MM via NETLink to process user inputs. In one example, the user will have a textbox in which they can write some simple numerical expression, and using MM together ...
0
votes
0answers
28 views

Sending a command to an already opened frontend

I'm trying to pipe low-level notebook commands to work through terminal and I've tried various ways, but I can't really get to the frontend that's already open. For example Opening a notebook from ...