Hot answers tagged clipboard
10
Since a native method is not forthcoming, I shall post my file based circumvention, for Windows.
You will need to have this utility in the command path (it apparently is stock with Windows 7).
copyUnicode[expr_] := Run["clip <",
Export["$Clipboard.temp", ToString[expr, InputForm],
"Text", CharacterEncoding -> "Unicode"] ];
Usage:
expr ...
8
Here are two functions that'll do what you need.
putClipboardImage[img_Image] := Module[{nb},
nb = CreateDocument[{}, Visible -> False, WindowSelected -> False];
NotebookWrite[nb,
Cell[BoxData@ToBoxes@Image[img, Magnification -> 1]]];
SelectionMove[nb, All, CellContents];
FrontEndTokenExecute[nb, "CopySpecial", "MGF"];
...
6
To circumvent Mathematica's internal representation, I decided to use the operating system. Of course, this means it's only going to work on Mac OS X because it uses Cocoa bindings in the built-in Python interpreter:
copyAsUnicode[t_] := Module[{
out = FileNameJoin[{$TemporaryDirectory,
"MathematicaOutput" <> StringJoin[Map[ToString, ...
1
This is a possible solution that I came up with after looking at another answer by @Ragfield: Encoding format used by GraphicsData?
I had to modify the function decodePICT in that post to cut out the leading zero bytes:
DecodePDF[data_String] :=
Module[{slash, backslash, zero, LF, CR, decode, codes, len,
i}, {slash, backslash, zero, LF, CR} = ...
Only top voted, non community-wiki answers of a minimum length are eligible
