Valentin H
Valentin H

Reputation: 7458

Command line arguments for Scratch 1.4

I'm using Scratch 1.4 for preparing a course for children.

The course is about controlling real devices (self built traffic lights, modified toys having motors, sensors, etc.)

For interfacing the hardware I'm using the Remote Sensor Protocol and the control-lines of a RS232 interface (3-in/3-out, all digital).

Everything works great, except small inconveniences: The children have to do many steps manually:

  1. start scratch first,
  2. load a template project which enables remote sensor protocol and defines variables
  3. accept the warning message notifying, that remote sensor protocol is enabled
  4. start RSP-RS232 proxy

I'd like to simplify it by starting scratch from my tool, ask Scratch to perform steps 2,3 by command-line arguments and finally connect to the RSP port.

Is it possible?

If not, is it hard to implement these parameters in Smalltalk for someone with no Smalltalk experience (but other languages like C++)?

Thank you!

Upvotes: 3

Views: 1251

Answers (1)

Valentin H
Valentin H

Reputation: 7458

Ok, after some readings I could answer my question.

Bad news is: there is obviously no command line argument in Scratch passing a project-file as a start-project.

However good news is, it is not difficult to change the scratch for own needs. Several projects do it, e.g.:

Scratch 4 Arduino

Scratch GPIO

How to do it is described here: http://wiki.scratch.mit.edu/wiki/Scratch_1.4_Source_Code

Scratch and Squeak

...

To get started, first copy the Scratch application ("Scratch.exe" or "Scratch.app") from your normal Scratch folder into the Scratch source code folder. (The Scratch application is actually just a Squeak virtual machine, so any recent Squeak virtual machine should also work.) Also, put copy of the Squeak source code file in that folder if needed (this file is included in the zip file starting with the 1.4 source release). Finally, drop the file "ScratchSourceCode1.4.image" onto the Scratch application. The Squeak programming environment will start up, allowing you to view and modify the Scratch source code.

I was able to disable the dialogue notifying that remote sensors protocol is enabled and to enable remote sensors at start by default. Took me 2 hours.

P.S.: For those interested, I host my project here: https://github.com/vheinitz/Qratzfest As I've found out, my Idea was not new (I've looked for this possibility about 3 years ago, but there was nothing). What is different, the proxy-tool is for PC, and is intended to use any hardware, not dedicated only to a specially firmwared Arduino or PI. Currently only control-pins of a serial interface are supported and linked to fixed names. Soon it will provide the possibility to map any pin to any Scratch-variable.

Upvotes: 4

Related Questions