Tag Info

Hot answers tagged

17

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


11

Declaration: This method for Windows is based on the .NET code from Todd Gayley's this wonderful answer. My .NET knowledge is absolutely ZERO, all credit goes to Todd. Code: The main idea is to extract the "Input"-style code string, convert it to the UTF-16 little endian form, which is the standard byte order in Windows, feed the bytes to system clipboard ...


9

Edit Fixed problem with pasting into textarea In some applications on Mac, copying as Unicode from Mathematica already works without having to do any postprocessing. However, it doesn't work in textarea fields in web browsers. Nevertheless, if you're willing to do a few additional mouse clicks, the Unicode forms can be brought into the browser by taking ...


8

As Mr.Wizard showed me here. Run the following with " " replaced with the pasted data. For example: CellPrint@Cell[ First@FrontEndExecute@UndocumentedTestFEParserPacket["Print[ \"test\" ]", False], "Input"] And here is a Palette with a Button that automates the process. CreatePalette@Button["Paste", NotebookWrite[InputNotebook[], ...


6

Here's a version that doesn't require a temporary file. Linux (needs xclip) SetAttributes[copyUnicode, HoldAll]; copyUnicode[expr_] := With[{ stream = OpenWrite["!xclip -in -selection clipboard", CharacterEncoding -> "UTF-8"] }, WriteString[stream, ToString[Unevaluated@expr, InputForm]]; Close@stream; ]; Example: executing the cell ...


4

As a start we can create a basic paste function using the ClipboardNotebook as follows: pasteRaw[] := NotebookGet[ClipboardNotebook[]] /. Notebook[{Cell[BoxData[data_] | data_, ___]}, ___] :> (CellPrint[Cell[BoxData[data], "Input"]];) After copying the desired text you can evaluate pasteRaw[] to paste it as input. At present no syntax checking ...


3

I'm not understanding, or I can't reproduce the behaviour of the pasting of the first part, please post a more concrete example. As to the 0.3333 issue, you could set the NumberMarks option of the input cells to False. Also, if you really meant that you wanted it copied as 0.3333 when your output had been 0.333333 you should also change PrintPrecision to 4 ...



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