Questions tagged [scripting]

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

95 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
16
votes
1answer
180 views

How to create a CLI for Wolfram language scripts?

Former question: How to use wolframscript to develop flexible command-line tools? I am currently changing a notebook into a wolframscript for a "production" environment, where I plan to ...
8
votes
0answers
95 views

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 ...
7
votes
0answers
272 views

Wolfram Script Console Doesn't Close Automatically on Windows

I'm not exactly sure how Wolfram Scripts are supposed to work. So I wrote a simple one to configure MaTeX for me so that all I have to do is double click it on a system where I've installed ...
7
votes
1answer
458 views

Difference between math and wolframscript

It seems that both math and wolframscript can be used to run Mathematica scripts on the ...
6
votes
0answers
216 views

How to properly call Wolframscript from Python?

I am using Windows 10 x64. If I run the following code in Command Prompt: wolframscript -code ToString[TeXForm["Integrate[Tan[x],x]"]] I get the following ...
6
votes
0answers
48 views

Logging modules in Mathematica?

Is there any logging module or functions or scripts that one can use to store all the information of what happens during executing mathematica program in Wolfram? For example, one might look up log....
6
votes
0answers
274 views

Passing UTF-8 to wolframscript on the command line

I am trying to use Unicode input to wolframscript -c, like so: $ ./wolframscript -c '1/∞' â^(-1) The source of this behavior ...
5
votes
0answers
83 views

Processor Detection Problem with Mathematica in Linux command-line

Here is the problem, there are two ways to launch Mathematica in Linux: Double click a notebook file in Desktop (GUI mode). It gives: $ProcessorCount (* 4 *) ...
5
votes
0answers
456 views

WL and WLS textformatting

I am really happy with the new wls (Wolfram Language Script) files. I somewhat abuse the file format, I use them instead of the regular Notebook files. The advantage is that they do not store the ...
5
votes
0answers
213 views

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.
4
votes
0answers
116 views

Using an existing local kernel when launching from command line

I am trying to setup a web interface to a couple of Mathematica scripts, which in itself is quite simple: ...
4
votes
0answers
83 views

Launching kernels… freezes

I'm running a Mathematica script on a remote machine (via ssh connection). I log on the machine and I execute math -script algorithm.m and this message appears ...
4
votes
0answers
63 views

Feedback for my autosave-script

last evening Mathematica crashed and hours of work were gone, because I forgot to save my notebook. During homework today I just pressed Ctrl+S every few minutes, to make sure that I don't loose my ...
4
votes
0answers
141 views

Wrapper for mathematica code with GUI

I have a code written in Mathematica. What I am trying to do is to write a wrapper (say using Python) that will take user input for the Mathematica code, run the code, and create output. I do not ...
4
votes
0answers
159 views

Can one combine Mathematica with bash script?

For example, I create a Mathematica nb file which can work on a set of parameter values or several files at once. It needs me to change the parameter after finishing computing one parameter. If I ...
4
votes
0answers
190 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 ...
4
votes
0answers
282 views

How to batch run Mathematica code from Python?

I have this notebook: ...
4
votes
0answers
307 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 ...
3
votes
0answers
72 views

Querying WolframAlpha from WolframScript

Is it possible to query WolframAlpha from a wolframscript query? The following yields $Failed: ...
3
votes
0answers
210 views

Privilege violation for file or directory

hopefully somebody can help me out with the following; I have a mathematica .wl script which uses ParallelTable; When I run this locally (laptop) it works perfectly....
3
votes
0answers
38 views

How to automatic close the Command window when a wolframescript is end of operation?

I have generated a .wls file in Mathematica 11. A command window will appear when the .wls runs, but the command window will ...
3
votes
0answers
132 views

Not getting any output from mathematica script

I am completely new, so this question may be trivial, but I can't find any answers in the Wolfram documentation. I am playing around with scripting in Mathematica, but I cannot seem to get any type ...
3
votes
0answers
188 views

Command line arguments to wolframscript interact strangely with -file option

In order to avoid script-defined command-line arguments clashing with existing arguments to wolframscript, it appears you are supposed to use the ...
3
votes
0answers
201 views

Wolfram Script as a Scheduled Task on Windows Server

I have a wolfram script file (.wl) that processes a csv file and generates a PDF output. I have written a PowerShell Script which checks for new input data files and runs the wolfram script file over ...
3
votes
0answers
195 views

Wolfram Script doesn't even start when there is no internet connection

I wrote a Wolfram Script, and I tried it when there was no internet connection. It couldn't run at all. I tried it many times. PacletInstall::dwnld: An error occurred downloading paclet ...
3
votes
0answers
205 views

About the new feature of wolframscript in version11.1

The verion 11.1 is available now,so the page of Mathematica Quick Revision History have summarize its upgrade.But the second last item is Self-executing Wolfram Language scripts extended to Windows ...
3
votes
0answers
142 views

How to send string to clipboard by wolframscript

Bug introduced in 11.0 and fixed in 11.1. This is my "t.txt" file ...
3
votes
0answers
227 views

A question on wolframscript

I'm trying to run a wolframscript by run RunProcess[{"wolframscript", "-file","my/script/file.wl"}]; The script file is too lengthy to be presented here. At ...
3
votes
0answers
350 views

`ParallelTable` pending the MathKernel after execution

I have done a ParallelTable computation in script mode. After execution, the output is fine and I've got all the data I needed. but the kernel seems pending, ...
3
votes
0answers
126 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
27 views

UnityLink called from wolframscript seems to work, but

I've tried to use UnityLink with Mathematica 12.1.1 on OS X 10.15.7. I found that code running ok in Mathematica FrontEnd does not run correctly if used in wolframscript. When exporting the notebook ...
2
votes
0answers
45 views

Running a Mathematica script passing parameters from within another Mathematica file

What is the recommended way to run a Mathematica file file_loaded.m from another Mathematica file main_file.m passing an ...
2
votes
0answers
68 views

Help with script for running AceGen generated routine in ABAQUS

I am using the below configuration to run a AceGen-generated viscoelastic element in Abaqus. Abaqus version: ABAQUS 6.14-6, OS: Windows 10, Visual studio: 2013, Fortan compiler: Intel Fortran compiler ...
2
votes
0answers
62 views

How to read input stream with no newlines?

I have a script named stdout.wl: ...
2
votes
0answers
88 views

How to use Mathematica code in LaTeX files?

How can you use Mathematica code in LaTeX files? any similar to A random number is RNUMBER and the square of RNUMBER is RNUMBER^2 appearing numbers instead the capital letters (or Mathematica code) ...
2
votes
1answer
113 views

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 ...
2
votes
0answers
70 views

Characters don't print right in WolframScript

Mathematica version: 12.1 & 11.3 Platform: Windows 10 Since windows's cmd is GBK, so my file is GBK. ...
2
votes
0answers
81 views

Difference between versions of WolframScript

On my computer (Windows 10) I currently have installed 4 instances of wolframscript.exe. They represent different versions of WolframScript program and each file is ...
2
votes
0answers
42 views

How to have batch script wait for free licence before executing?

Is there any way to make a mathematica script (that I'm running in batch using HTCondor) wait until there is an available licence before executing? Several of my scripts are returning nothing but ...
2
votes
0answers
115 views

How to get smooth fonts in SVG graphics generated through a WolframScript script?

Below are screenshots of the x-axis labels plots generated and exported in SVG format using exactly the same code, either "interactively" or "programmatically": interactively programmatically By "...
2
votes
0answers
200 views

Wolframscript running slow on linux?

I tried running a simple wolframscript example on ubuntu with v11. Why does this example take so long? ...
2
votes
0answers
228 views

mathematica example for parallel run

I want to run a parallel mathematica example via a PBS script. I am not expert in this application, instead as a system administrator, I have to be sure that users are able to submit parallel jobs to ...
2
votes
0answers
436 views

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....
2
votes
0answers
166 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
868 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: ...
2
votes
0answers
85 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
0answers
27 views

Problem in redirecting output from wolframscript

I am having a very strange problem in scripting with wolframscript. As a MWE I have a .wls which prints its command line argument. I launch several of these scripts with a bash script, each ...
1
vote
0answers
14 views

Initializing section header doesn't mark sub cells as initialization cell

I have some definitions organised into Chapter>Section>subsections etc in a notebook. I wish to run this code in wolframscript so I tried (following advise from various question on SE) exporting ...
1
vote
0answers
115 views

WolframKernel not found when running WolframScript

While attempting to run wolframscript in linux, I get the error "WolframKernel not found. Use -configure to set WOLFRAMSCRIPT_KERNELPATH Or export WolframKernel=/yourpath/WolframKernel" I am ...
1
vote
0answers
39 views

How to retrieve the original mathematical expressions from some sort of scripts?

I quit my Mathematica notebook session mid-computation. When I reopen it, the mathematical expression disappeared leaving something like ...