Tag Info

Hot answers tagged

24

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] ...


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 ...


19

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 ...


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 ...


12

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). ...


12

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 ...


11

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, ...


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, ...


11

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

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. ...


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

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, ...


9

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 ...


8

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`"] ...


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

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 ...


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 ...


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

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 ...


6

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", ...


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

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 ...


4

Yes, you can. There is undocumented FE command-line option -directLaunch which switches off the mechanism which always launches the most recent FE version installed. Under Windows you can use a .reg-file for switching .nb-associations between different MMa versions installed. Before proceeding, I should point out that modifyng the system registry is ...


4

I don't think this is a difference between Mathematica and the Player Pro but between Mathematica 8 and 9. For me Mathematica 8 brings up the same dialog as Player Pro 8, while Mathematica 9 brings up something slightly different (my interpretation is that WRI has improved the automatic behavior, I'm not sure whether I'd call the old behavior to be wrong or ...


4

My feeling is that your Windows system is performing like it should and that the problem lies with your OS X system. Using the -> instead of :> causes the immediate evaluation of the right hand side of the rule yielding an expression of the form StringReplace[a, (StartOfString ~~ Whitespace) | (Whitespace ~~ EndOfString) :> ""] with a still ...


3

This isn't a full answer, but maybe those with more knowledge can take it from here. To capture key presses of a particular key, one can do the following: k=0; SetOptions[$FrontEndSession, FrontEndEventActions -> {{"KeyDown", "q"} :> (++k), PassEventsDown -> True} ] The previous example increments k each time the letter q is pressed. Note: ...


3

Apparently Ctrl+F6 and Ctrl+Shift+F6 are default Windows keyboard shortcuts, although I was only aware of the Tab variants. Because of this, these commands on not (apparently) configurable from within Mathematica. Further, Mathematica does not recognize the Tab commands. It may be possible to rig something using SetSelectedNotebook but so far I have ...


3

First of all you need to be careful. For example deploying large enough content of fixed window size would create problems on small computer screens. That warning being said, this is what you can do. Imagine this is your interactive content: m = Manipulate[Plot[Sin[f x]/x/f, {x, -6.6, 6.6}, PlotRange -> {-.3, 1}, Filling -> 0], {{f, 4, ...


2

Are the relevant lines PulsProp[\[Omega]_, N0_] = Simplify[Det[matK - (\[Omega]^2)*matM]] and test = Solve[PulsProp[\[Omega], 5000] == 0 && \[Omega] > 0, \[Omega]]? If yes, you might get a much more stable behavior by noting that $\omega^2$ are in fact the generalized eigenvalues \[Omega]2 = Eigenvalues[{matK, matM}] where you can select the ...



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