Tag Info

Hot answers tagged

26

Copying my answer from StackOverflow (edit, now updated) ... If you are on Windows (with .NET), then you could use Mathematica's NETLink functionality in conjunction with the WebBrowser class to capture a screenshot of a web page: Needs["NETLink`"] LoadNETType["System.Drawing.Imaging.ImageFormat", AllowShortContext -> False] ...


21

On Windows 7 using ReadList instead of Run suppresses the window: Table[Pause[1/2]; ReadList["!dir", String], {3}]; This use of "!command" in place of a file is at least partially documented under OpenRead: On systems that support pipes,OpenRead["!command"] runs the external program specified by command, and opens a pipe to get input from it. As ...


19

You need to add the following to KeyEventTranslations.tr: Item[KeyEvent["Tab", Modifiers -> {Control}], FrontEndExecute[FrontEndToken["CycleNotebooksForward"]]], Item[KeyEvent["Tab", Modifiers -> {Shift, Control}], FrontEndExecute[FrontEndToken["CycleNotebooksBackward"]]], This will map Control-Tab and Control-Shift-Tab to cycling between ...


15

You can call an external (shell) command cmd without showing a command window by using the pipe syntax "!"<>cmd. This can be used in place of a filename with any Mathematica function that opens a file for reading. For example: Import["!dir", "Text"] Read["!dir"] (opens stream, must be closed) OpenRead["!dir"], followed by Read, ReadList etc to grab ...


13

After much digging, I found this MathGroup archive detailing how to get Mathematica working with SQL servers protected by Windows authentication. It's repeated here mainly for posterity's sake. Download the jTDS files from here: http://sourceforge.net/projects/jtds/files/ Unzip and locate the ntlmauth.dll file in the appropriate folder (x64, x86, IA64). ...


13

There are a few problems with your code. If you fix those up, as I did, your program will run fine. First off, the reason you see "no source available" when you pause the program is probably that when you break, the program is down inside a MathLink function, and so it is complaining that it doesn't have access to the MathLink library source code. To debug ...


12

Until a better answer comes along, I present, for your edification, an ugly hack that isn't really Mathematica per se: Needs["CCompilerDriver`"] src = " #include \"WolframLibrary.h\" #include <windows.h> #include <string> BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { char title[256]; GetWindowText(hwnd, title, ...


12

Even the path is corrected, it still cannot run, since the argument type should {"double*", "double*"}. Here is my memo on calling dll created by gortran using NETLink: Advantages of NETLink as compared to Mathlink: FORTRAN functions and subroutines can be called using .NET/Link without writing additional C wrapper which is necessary in Mathlink. ...


12

First, be sure to read the Specific Compilers section of the CCompilerDriver User Guide. This is the official place where the nuts and bolts of using external C compilers is discussed. In that section, "Visual Studio Express and 64-Bit Targets" is where compilation on 64-bit Windows is discussed. Some things to check when setting up: Be sure to install ...


11

Mathematica 8 automatically detects Intel version 11, but not Intel version 12 which was released later. In order to use the Intel 12 compiler, you'll need to set $CCompiler to point CCompilerDriver to where you've installed the Intel compiler: Needs["CCompilerDriver`"] $CCompiler = {"Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler, ...


10

Setting a FontOpacity less than 1 appears to prevent sub-pixel rendering and therefore provides output similar (perhaps identical) to that obtained with ClearType switched off. text = Style["αβημπρτ", 20, FontFamily -> "Arial", FontOpacity -> 0.999]; Rotate[text, # °] & /@ {90, 90.1, -90, 85, 95, 45, 0} One possibility to automate this, and to ...


10

Arnoud Buzing in chat made us aware of this support page that discusses possibly related issues. UPDATE: A new version of the Windows installer has been placed on the Wolfram Portal. Its file hash is: F3EEC3AFEC3186001A1A237C88B7A991 You can check this with the following command: BaseForm[FileHash["Mathematica_9.0.0_WIN.exe", "MD5"], 16]


10

As indicated in the documentation, one can access the Mathematica kernel from the command prompt using the command math in Unix/Linux and MathKernel from Mac OS X/ Windows. If the MathKernel command is not in your PATH variable, you can try one of several things: Enter the full pathname as part of the command Add MathKernel as a PATH variable using the ...


10

Here is a considerable simplification of Liam's accepted answer. It avoids the need to create and compile a C# program. This is basically just a small modification to Simon Woods' answer, so that it writes directly to the clipboard instead of creating a temporary file on disk. This avoids the need to clean up the file afterward. Needs["NETLink`"] ...


10

Something like this? It does just what you suggested: export the file and then place a FileDrop reference to it on the clipboard. Needs["NETLink`"]; InstallNET[]; LoadNETType["System.Windows.Forms.DataFormats"]; LoadNETType["System.Windows.Forms.Clipboard"]; exportToClipboard[graphics_] := Module[{dob, file}, file = FileNameJoin[{$TemporaryDirectory, ...


8

The following code copies the actua PNG image to the clipboard with transparency. This varies from the other answer in that it actual stores the entire image instead of a reference to the file. This code will likely work with more applications then the one above. It currently uses the Ctrl+Shift+C to copy with transparency. The code takes a while to run ...


8

Suppose you create a file addtwo.tm : :Begin: :Function: addtwo :Pattern: AddTwo[i_Integer, j_Integer] :Arguments: { i, j } :ArgumentTypes: { Integer, Integer } :ReturnType: Integer :End: :Evaluate: AddTwo::usage = "AddTwo[x, y] gives the sum of two machine integers x and y." int addtwo( int i, int j) { return i+j; } int ...


8

I have contacted the Wolfram support ([CASE:1292216]): Dear Andrew, Thank you for contacting Wolfram Customer Service. We simply ended our support of XP shortly after Microsoft had announced they would no longer support XP themselves. XP is going to become to difficult to handle without any kind of support from Microsoft as many of the issues we ...


7

The command line option to call the kernel with to suppress the taskbar button is -noicon. You need to pass this flag to MathKernel.exe when launching it. Here's a demonstration from within Mathematica: kernel = LinkLaunch[First[$CommandLine] <> " -mathlink -noicon"] This will launch a new kernel and connect to it. On Windows, the new kernel will ...


7

I had nearly the same problem approximately 2 years ago. If you mean the data communication with MS SQL from Mathematica, you just need to use the DatabaseLink package. I'm using MS SQL 2008, Windows 7 64-bit Enterprise and Mathematica 9. Sometimes, you need to add a bufferdir statement in your OpenSQLConnection string. You can find some more information by ...


7

I am using Windows 7 Professional, SQL 2008 and Mathematica v9. I had endless problems connecting and getting things to work, but after a lot of back and forward between Wolfram support and myself I got the following to work: Needs["DatabaseLink`"] Connection1=OpenSQLConnection[JDBC["net.sourceforge.jtds.jdbc.Driver", ...


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

It turned out that the MathematicaClosingDialog.nb is a nice example for a graphical user interface that solely uses the FrontEnd MathKernel. On the downside, one has to deal with low-level code. First I made a copy of the original MathematicaClosingDialog.nb, renamed it as MathematicaClosingDialog_Default.nb, and then imported it into a notebook: nb = ...


6

Table[Pause[1/2]; Import["!dir","Text"];, {3}]; Import can also be used to pipe command line output straight into Mathematica. <<"!dir" Also works.


6

This is AFAIK not dependent on the OS but how you run Mathematica. If you only run the Kernel in batch mode, it is $Input which you can ask to get a file path of the script just running. It sometimes needs some extra care as it will not always hold the full file name if I remember correctly. I'd start to just print its content in your script and then ...


6

Update: This is now fixed in Mathematica 10.0.1. This is an issue on Windows only. We are aware of this, and it is planned to get this fixed in the next release of Mathematica. If I get the fix earlier and it is easy enough to create a patch, I will post the workaround here. As far as I know, there is no such issue with R 3.x.x on Linux. Currently, RLink ...


5

It seems your Windows system works differently than mine (Win7-64). I don't believe I can use the Ctrl-Space combo, but I know how to change the setting: Right click on the language symbol in the task bar Select Settings from the pop-up menu, in the resulting dialog box pick the 3rd tab Select the action by clicking on a keyboard name, and pressing ...


5

You can achieve it by removing "ResizeArea" element from WindowFrameElements option of the CDF file. For example, we generate a resizable standalone CDF and open it in Mathematica: cdfpath = CDFDeploy[ ToFileName[{$TemporaryDirectory}, "thisistest.cdf"], Manipulate[n!, {n, 1, 10, 1}], WindowSize -> {400, 200}, Method -> "Standalone"]; nb = ...


5

Mathematica 8 will only run on the Surface Pro since it has a x86 processor (Ivy Bridge Core i5) and runs Windows 8 Pro (which is the same as the desktop/laptop version). The Surface RT will have an ARM processor which means that if you want software to run on it, you should recompile it for ARM. Mathematica 8 is not compiled for ARM, so it will not run. ...


5

In Version 7 on Windows 7 this configuration appears to produce a horizontally centered window: winMargins = {{Automatic, Automatic}, {130, Automatic}};



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