How to execute a custom block with given spec (if it is defined)?

So I need to execute a custom block with a given spec.

This is my exploration:

var g=function(k){
var info=this.project.stage.globalBlocks.filter(function(e){return e.spec===k})[0];
var block = info.type === 'command' ? new CustomCommandBlockMorph(info,false) : new CustomReporterBlockMorph(info,info.type === 'predicate',false);
var inputs = block.inputs();
block.cachedInputs = null;
return block;
world.children[0].sprites.contents[0].scripts.children.push(g("fetch project %'name' by %'creator'"));

I'm taking a vacation. While I'm reading the forums posts twice a day I'm not interested in anything that y'all consider to be "advanced", except truly advanced uses of Snap itself. So, if you use Snap! to make a neural net, a sheet music editor, a cool game or something that sparks my interest I'll respond. What I am not currently interested in is suggestions involving JavaScript or using / abusing things in the source code that I have already written but not exposed to you yet, such as anything concerning colors, block specs, programmatic manipulation of blocks, anything that has the word "module" in it. Did I mention I'm not impressed when somebody knows JavaScript. There are a bazillion able JS programmers around, JS is the most popular programming language on Github. If you want to impress me, do something in Smalltalk. Seriously. I only use JS because of the browser.

But if you really want to impress me, do something creative!

And please, please, pretty please do not call me out in the forums. I do read every forum post several times a day. If I don't react or answer it's because I'm on vacation. Did I mention I'm neither interested nor impressed if you know JavaScript or can read my source code? It's what source code is written for, anybody can do it. It's not meant to be a secret, and it's not meant to be "advanced" in any way. It's just JavaScript.

Impress me with creativity!



Thank you very much for this post. I'm 74+, I'm retired. I don't speak English (I apologize for using the translator). I'm not from the industry, I'm a builder. I don't know JavaScript or Java or any other programming language. Only once, at Sinclair Spectrum, have I tried Basic and Pascal. I never created a website. I "discovered" Snap about two years ago and sometimes, especially in winter, I enjoy it. And very much so.
Sometimes I also wanted to help myself with the JS block, so I tried to sniff out some of the source code. But I've always felt that this isn't about JS, the right joy is using available or new custom blocks in Snap! Your post confirmed to me that this is probably the right approach to this amazing "language".
A few more words about the new libraries - my opinion may not be in line with your intention:
Snap should not extend "to infinity" with new features. This then forces a change of approach. Instead of a creative solution to the problem by the given means, there is a search, learning new functions and their parameters, the problem of remembering everything, simply the creative capacity of the brain changes to the capacity of data storage.
By that I mean that there is probably some "optimal size", when exceeding it no longer means more joy and fun from a "mastered" system, but rather a feeling of my own inadequacy over what I still have to learn for that joy to come.
On the other side:
For example, I tried to access variables using a text name. But when I was a bit "successful", I discovered a new library (I mainly use Snap off-line), where it was solved. Great! Better access to the "system" is always useful.

Thanks again not only for the pregnant advice on how to use Snap, but especially for Snap as such! For the freedom and creativity it allows. Really great!

Regards Georges

I found a solution:
To execute a command you can put it in an ignore block.

Um……no.Dont put a true in the 3rd parameter of proc.evaluate