Scratch: How do I produce an ascii text program listing?
Asked Answered
V

3

5

My nine year old son is applying to participate in a programming contest. Any language is allowed, and he wants to use Scratch. But the application requires an ascii text listing of a program to solve a specified preliminary problem. They will not accept a PNG screenshot, or Scratch's binary format. So how does he get an ascii listing of his program? If it is impossible (as I suspect) then I will just read his program and retype it into an ascii editor.

Vanmeter answered 12/3, 2014 at 19:41 Comment(1)
Scratch is written in Flash. Any possibility of getting & dumping the SWF? And let the contest hosts know they're behind the times!Twilley
P
6

You have a few options here.

If you're using Scratch 1.4, you can save a text-only project summary. Shift-click the File menu, then Write project Summary.
This functionality is coming soon (hopefully) to Scratch 2.0. UPDATE: It has been added.

You can also get a text-based representation of all the blocks using the Scratchblocks generator.

Or, you can save the 2.0 project as myproject.sb2, rename to myproject.zip, unpack the ZIP, and take the project.json file.

Unfortunately, none of these methods can easily be imported back into Scratch.

Papotto answered 10/8, 2014 at 7:28 Comment(0)
N
4

http://scratchblocks.github.io will convert your project into scratchblocks format. It is exactly what you are looking for.

Nanananak answered 27/10, 2014 at 13:28 Comment(1)
This is great, because then it exports to both code you can visually see or simple readable code you can load in to the editor.Hizar
M
0

You can download and edit the json script for the Scratch project. It can then be uploaded to replace the existing project. (This is also a great way to back-up and deploy projects)

  1. From the "See Inside" screen, File->Download to your computer.
  2. Rename the file to have a ".zip" extension instead of just ".sb2".
  3. Unzip the file to edit the "project.json" file.
  4. Edit the json code as desired.
  5. Reassemble the zip file
  6. Remove the ".zip" extension. (Back to ".sb2")
  7. Update the Scratch project by going to the original project and selecting File->Upload from your computer.
Mcphee answered 13/4, 2015 at 22:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.