Calling Supercollider script from Windows batch file?

I’m unsure of the most recent status, but it looks like command-line usage is not working in Windows: Windows / readline / MSVC · Issue #2171 · supercollider/supercollider · GitHub

When you run sclang with a script file, no prompt will be presented. The only interaction you can do at that point is via GUI objects.

– begin code –

Please use triple backticks to delimit code. Code markup: Correct style

The easiest way is s.waitForBoot { /* in here, all of the code that should follow server boot */ }. “All of the code” may be a very long block. If the server is already booting, it won’t boot a second time (and waitForBoot will wait for the existing boot attempt to complete).

The function runs in the context of an AppClock thread, so it can wait or s.sync or use Condition for further waiting.

The 0.exit needs to be in a thread that will wait for the work to be done, or in a GUI object for the user to trigger.

Part of the issue here is that script usage really depends on understanding threads and scheduling. If you haven’t read the scheduling chapters of the tutorial, most of this may not make much sense.

It’s absolutely essential in a script to run things in a context where you can pause and wait for completion before moving on (unless all of the computations are synchronous, which is never the case when a server is involved). In SC, this is a Routine (or Task).

Note that waitForBoot implicitly creates a Routine based on the action function – so you’re halfway there with that. Then you need to understand how to wait for completion – see the Condition help file.

I can perhaps post an example a while later.

hjh

1 Like