Cut & Paste of Blocks

Is there any hope of having the ability to c&p of blocks between editor sessions?
Or even an exchange mechanism ala MIT AI2 and its backpack concept?

I know there is export blocks, but very cumbersome to use for small jobs and litters the directories with XML fragments. Not to mention, it only works with loaded library and custom blocks.

As far as I know, there is no way to select an arbitrary set of code blocks, copy it and paste it. That is what I am referring to.

The "arbitrary set" part means that you'll need something like the existing Export Blocks dialog. So really I think what you're asking for is just an "export to clipboard" option in Export Blocks. I also would occasionally find that useful, but not so much more convenient as to make it a high priority.

What I really want is to make the project name directly editable, so I don't end up with files with names like "untitled (5).xml."

The other thing along the lines you're suggesting that would be harder to implement, but I think more useful, would be the ability to drag out a rectangle in the scripting area and have all those scripts selected. The most common use case would be to delete them, but copying to another sprite is also sometimes desirable. Right now we have no concept of even a single selected script, except in the context of keyboard editing.

tl;dr: Possible but not likely to be a high priority.

Export to Clipboard would be just fine, if only Export Blocks allowed selection of any of the desired code blocks. Now, it only selects custom and library blocks.
Also, my objective is to c&p between different SNAP! tabs in the browser or offline versions.
But I understand the tl;dr: :sunglasses:

I don't understand. You want to export primitives?

I think he wants to export a selected script (which does contain some primitives, too, yes) to Clipboard in order to be able to paste the script into another :sn: project opened in another browser tab, if I understand correctly.

Yes, I would like to be able to extract any set of blocks (regardless of custom, library, primitives) and be able to paste them to another running version of SNAP! in the browser. This will make code reuse easier.
This is possible with microBlocks, MIT AI2, etc.

Ah, thank you. When you said "set of blocks" I was thinking of something like a library, not a script.

For scripts, I would take off the hat block, define a new block with the rest, and export that. As a workaround with current features, I mean.

wasn't it possible sometimes via the community page?

And you can download just scripts!!

Yes, it's not a drag and drop feature... but go to any script, press [Shift]+[Right mouse button] and you'll get a hidden (red) "download script" option.
You'll get an xml with only this script, and you can drag and drop it to get that script in any other Snap! project.


but it doesn't save custom block definitions in the xml, so if you don't have the custom block in the project already, it'll be an obsolete! block

unless of course that was changed in 6.0

Yes, you are right (even in 6.0)

But I think this answer the original question (to copy some blocks (a script) to other Snap! editor). And yes, this only copy this.
Maybe those scripts use global variables, or references to other sprites (tell, ask...), or broadcasting mesages... but this feature just copy these blocks.


That's why it's hidden behind shift-click. It's really not a finished feature we'd want to show users. (I'm not saying we're working on finishing it! That's definitely not a priority.)

@jguille2 & @bh
Thx for all your pointers. Every little bit helps. And yes both options will be useful.

When I do this, I get Snap!'s and Firefox's context menu, and Snap! thinks until I press shift again, that I'm holding shift down...