5

Sometimes code or data in a posted question is in a box with a horizontal slider. Is there some way to select all of the data and copy it to put in a Mathematica notebook? I can only select what is displayed and then material outside the box, but never all the material within the box.

3
  • Dragging selection outside code block will force it to scroll. But I'm also interested in neat solution.
    – Kuba
    Commented Aug 7, 2013 at 14:00
  • You can also use this answer to import all of the code in a post using the URL from the "share" link
    – rm -rf Mod
    Commented Aug 7, 2013 at 16:13
  • @ Kuba Dragging outside the code block in IE did not work for me. It ended up selecting material outside the code block. The triple click did work.
    – David Park
    Commented Aug 7, 2013 at 19:15

2 Answers 2

6

For all those who use browser user scripts: there is an Select Code Block Button Script which I have tweaked further to work for our site and Chrome. You can find my answer here

The script is really easy to use. As soon as you move the mouse over a code block, a Select button appears which when clicked selects all the text in the code block; with or without scroll bars.

enter image description here

3
  • I get some weird interaction on Firefox Commented Aug 9, 2013 at 15:11
  • @belisarius Hm, this is very unfortunate. I always thought the script was made for Firefox. Can you try the original script and change the header appropriately? You can just copy my header, so that it is working on on M.SE.
    – halirutan
    Commented Aug 9, 2013 at 17:03
  • Yep, the original one seems to work better with Firefox (v23.0). I haven't tested it extensively, but at least the edit window buttons are there Commented Aug 10, 2013 at 1:17
1

In Firefox you can triple-click to select a full line, then while still holding the mouse button drag up or down to select additional lines.

Here is some junk code to test it on:

#/.(##&[15#->FizzBuzz,3#->Fizz,5#->Buzz]&)/@#&@Range@100 #//.(##&[15#->{3#,5#},3#->Fizz,5#->Buzz]&)/@#&@Range@100
foo[x_, y_, z_, opts1 : OptionsPattern[], z : {opts2 : OptionsPattern[]} : {}] :=  Grid[{{Plot[Sin[x a], {a, y, z}, opts1], Plot[Cos[x a], {a, y, z}, opts2]}}]
f4[s_, m_] := s[[#]] & /@ SparseArray[Permutations[1 ~Table~ {m} ~PadRight~ Length[s]]]["AdjacencyLists"]
1
  • OK, many thanks. That also works for Internet Explorer.
    – David Park
    Commented Aug 7, 2013 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .