# Tag Info

## Hot answers tagged script

8

This turns out to be easy. In Windows 7: Add C:\Program Files\Wolfram Research\Mathematica\9.0\ to the path. Write procedures for what you want to do in The Wolfram Language, and save in a .m file. Add MathKernel.exe -script filename.m to the Windows Task Scheduler. Specify that the job runs in the directory containing the .m file. That seems to be it. ...

7

I have automated a nightly backup process with Mathematica. I use a task scheduling program to run a longer version of the following .m file below with MathKernel. Functions like Complementmake it easy to copy new files from a working directory to a backup directory, and in general, Mathematica makes it easy to use sophisticated logic along with various ...

7

The command Run will do exactly that. For example, try Run["touch ~/Desktop/blankfile"] If you want to read the results back in, there are a few options, and the choice between them depends on exactly what you want to do. The RunThrough command lets you read the output of a command-line back as a Mathematica expression. For example, try ...

6

Here is a minimal example on how to run a mathematica script on a raspberry pi. Create a simple script (I used my bash terminal to do it): echo "sum=1+1; Print[sum]" > test.wl Excecute the script: wolfram -script test.wl 2

5

According to the documentation, To suppress the loading of kernel initialization files, use the kernel command-line option -noinit. To specify another file to be used for kernel initialization in addition to init.m, use the kernel command-line option -initfile file, where file is the additional initialization file.

4

On Windows there are two kernel executables: MathKernel.exe and math.exe. MathKernel.exe has its own input window, which may show up separately when you start the process from a command window. If you run it in MathLink mode, it may still show as a taskbar button. math.exe runs in a standard Windows command window. If you start it from within an existing ...

4

(* make the task, fires once a minute *) task = CreateScheduledTask[PutAppend[MemoryInUse[], "myMemory.log"], 60]; (* start the task *) StartScheduledTask[task] (* ... do your thingys ... *) (* stop (or remove) the task *) StopScheduledTask[task] RemoveScheduledTask[task]

3

Clusters can be significantly different from each other, so I strongly recommend you talk to someone who uses the same system and ask them for help with the details. However, there is one thing that is clearly incorrect in your job script: To run a script with Mathematica, you need to start the kernel (command line program), not the front end (graphical ...

2

This is not an issue with Mathematica itself. It's related to how you closed the session on the remote machine. If you use screen, you should detach from the current screen session before exiting, otherwise you'll close the current shell together with its child processes, including Mathematica. Alternatively, just use nohup, and do not bother with screen: ...

2

You can solve the issue by wrapping your code with UsingFrontEnd[].

2

For this kind of "logging" in SubKernels for example I use the following code: oldoutput = $Output; (* store$Output *) oldmessages = $Messages; (* same for$Messages *) CheckAbort[ logstream = OpenWrite["yourlog.log"]; $Output = {logstream}; (* redirect$Output *) AppendTo[\$Messages, logstream]; (* add the logfile as an additional destination for ...

2

I'm not sure on which operating system you are and whether this makes a difference, but your 4 choice don't do the same. math -run file.m edit: When you change this command to math -run < file.m then it does the same as the next (wrong) alternative. Doesn't do anything with the content of file.m at all, because the -run option expects a command ...

2

Boardman's tutorial (now in v3) really is excellent (especially for beginners like myself) and has been updated to take into account new image processing functions in MMA v10. It's readable on a Mac using the iBooks.app bundled with OSX 10.9+ and there's also a YouTube version (though I've not had a chance to look at that yet). As to how the Manipulate ...

1

There are a number of ways to grab moving images off a screen, and for iBooks/iPad resolution, that should be plenty good, though not so much at your local iMax. Examples: http://www.screencast-o-matic.com/ http://www.movavi.com/screen-capture/

Only top voted, non community-wiki answers of a minimum length are eligible