Questions tagged [scripting]

For questions about Wolfram Language Scripts (formerly known as Mathematica Script), or running the kernel without direct user interaction.

Learn more about Wolfram Language Scripts:

359 questions
46
votes
1 answer

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 is the Wolfram documentation search dialog to…
Alan
  • 13,686
  • 19
  • 38
17
votes
1 answer

What is the difference between Wolfram Script and Wolfram Engine?

I don't understand the difference between these products: Wolfram Script Wolfram Engine Would someone help me understand what these are? And how it differs from just using Mathematica in the terminal.
QuantumDot
  • 19,601
  • 7
  • 45
  • 121
16
votes
2 answers

Line by line processing with a WolframScript

I am having some difficulty understanding the correct syntax to enable a line by line processing of a file using a WolframScript. What I would like to do to mimic this simple python pipe in Mathematica. Take a python file…
Mike Honeychurch
  • 37,541
  • 3
  • 85
  • 158
14
votes
1 answer

Difference between math and wolframscript

It seems that both math and wolframscript can be used to run Mathematica scripts on the command line. Which one I should use, are they cross-compatible and what are the differences?
Daniel
  • 499
  • 3
  • 11
9
votes
1 answer

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 new line which reads (* ::Package:: *) at the…
Chris
  • 91
  • 1
8
votes
0 answers

Detect if running in a script

Is there a reliable way to detect if the current code is running within a script? Note that there are multiple ways to run a script, such as wolframscript -file file.m wolframscript -script file.m math -script file.m One might add math < file.m,…
Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
7
votes
1 answer

Executing Mathematica code via Notepad++

I wonder if there is a way to execute Mathematica code via Notepad++. After some searching on the web, I found that there is a user-defined language that supports Mathematica highlighting, but there are no instructions on how to execute Mathematica…
Yorgos
  • 229
  • 1
  • 6
6
votes
2 answers

Passing negative parameters to a wolframscript

How do you pass negative values as input for a wolframscript? This documentation page explains that the syntax for passing parameters is: wolframscript -file filename.m 1 2 3 output.txt However it seems it doesn't work with negative parameters,…
mattiav27
  • 6,677
  • 3
  • 28
  • 64
5
votes
0 answers

Lisp Interpreter

What is the cleanest way to build a lisp interpreter inside Mathematica. I'm not looking for all the functions to be implemented but instead just the basic syntax.
William
  • 7,595
  • 2
  • 22
  • 70
5
votes
2 answers

How to automate Mathematica scripts? - I

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 up the notebook/file so it will execute when…
George Wolfe
  • 5,462
  • 21
  • 43
5
votes
1 answer

Stop a script. Just stop it

How can I stop a mathematica script? Abort[] does not stop the script, just jump over a number of lines and proceed with next lines of calculations. Also, killing the kernel seems not good idea. All I want is C++ exit(0); or Java's…
Chameleon
  • 275
  • 1
  • 4
4
votes
0 answers

FrontEndObject::notavail: error when using math

I am new to mathematica script and thus I don't know whether this generated error is natural or not. When I write a command such as echo "3" | math in the terminal. The output generates Mathematica 10.0 for Linux x86 (32-bit) Copyright 1988-2014…
Sungmin
  • 2,285
  • 15
  • 23
4
votes
1 answer

Run .m file in terminal

I have the following .m file (* ::Package:: *) (* ::Input:: *) (*out=1+1;*) (*Print["Test"];*) (*Export["/path/test.txt",out];*) and I am trying to run it in the terminal with math -run -nomprompt < name.m but it doesn't work. I have changed the…
hal
  • 783
  • 3
  • 14
4
votes
1 answer

Why is .mn file being generated?

I am running a Mathematica code inside a shell script, using math -script .m. But after the script finish its run, I get a duplicate (or backup?) file .mn . Why is such a file being generated? Is there a way to prevent that?
hbaromega
  • 183
  • 1
  • 7
3
votes
0 answers

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 f. I execute it using the "math -script table.m&" command. As it takes a very long…
Aecturus
  • 76
  • 3
1
2 3 4