This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-05-31 09:43:12

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Editing Scratch Projects in Notepad

*NOTE: This only works on Windows, as far as I know!*
Note: Instructions are for Windows Vista Home Premium. Steps may differ for other versions of Windows.
Note: When I am able, I'll upload some screenshots to help.  smile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LS97 reminded me of something:

LS97 wrote:

Ehm, let me just share a small tip with you:

Make sure you have some sort of backup copy of whatever project you're trying to edit. I accidentally messed up one of my projects, and good thing I had it shared on Scratch. Otherwise, would've lost it for sure.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you ever think there might be a way to edit Scratch projects outside of the program? If you did, you are right, I think. Projects can be opened, viewed, and saved from Notepad. When I tried, it caused an error, but I had no idea what I was doing.  tongue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Instructions:

A: Creating the Project
  1) Open up Scratch.
  2) Delete the Scratch Cat, it will make it easier.
  3) Put a when green flag clicked block into the Stage.
  4) Save it as "flag" with no author or project notes.

B: Opening the Project
  1) Go into the folder where you saved it.
  2) Single-click on the file.
  3) The bar above (Vista) should read this:
      Organize v  Views v  Open v  E-mail  Share  Burn
  4) Click the drop-down for Open.
  5) If "Notepad" is an option, click it. If not, follow the following steps:
    I) Click "Choose Default Program" at the bottom.
    II) Click the "Browse" button.
    III) Paste this into the address bar: (Replace USERNAME with your account)

C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories


    IV) Click on Notepad.
    V) Click Open.
    VI) Uncheck the "Always use the selected program to open this kind of file" option.
    VII) Click OK.

C: Understanding the Project
This is the difficult part.
You should now have the file flag.sb open in Notepad.
It should look like this, more or less:

Code:

ScratchV02  pObjSStch      c  c  c  c  c  c  c  c      c  
c  c  c  
c  c  c  c         history       >2011-5-31 15:52:59    save    flag        
2011-5-31 15:53:32    save    flag        
       platform       Win32       language       en       
os-version       NT       scratch-version       1.4 of 30-Jun-09           thumbnail#   x c  c         comment           author           âXéaÿ   c  c       ?ÿÿÿObjSStch   }c  c  c    c  c  c  c  c      ?ð          c  
 d <c  c  !    àh    ?ÿÿÿ       Stage       c  
   c      c  ¢c  c  c                 c  c  ¤c  c   d 2       background1"àh c    ð ´  l@Z@        c         popmc    € c  +  €    õÿ  Ta    c  c         Õ½
rïS#<$› â«sñUÚ_Ä`³©i¨’±åÅGáAó&íGÑaJo}p#a
DÎêó*ɧj‘ý%˜îµ9Ýèâ:`Dvpyµh¢EØgäJµl’zÞ†kŸqÈŽü!0â]}yßäq7M©¶ç©¸O–Œ‰‘i®OÙõ\< _PoïiNV$
òqÅY£g“¶™x²øÚh    £6ŽWkf)_¢F¼õòÈÊ­õ¢Î«Ä2êñÀ9«Q(VñI4+NÛ,º¾¨ì©¼ÑÝŒ¼.<K€YR'9]¬êÅq­­§)³ºÐö°¥?zQÈQÊ?k}ùçÖÓ¾¶¾UÕ¬õ¼*3‚Aõ@„/,òW՟ó¿õËtãœz z6‰?†8Ò$:Ãç’ο†ÀÏéQk%~: A8µ#–Sè/ÏVÂ*ÂêÑZêI"”5×<Ð5ì#J    ZîGØËwË
Öfêo±’*30x+ª<ôódá¿×¸Öö߬ïÍ)\#¨H«¯óRæpߺàÛé3öÌ$ÛòJ„É|òäç5á
á†èzôg¡,_Œ^=þtòçêÊç–é„ïàøùÔJ’Ù    7ûyöô–õÝù×ÿŽ—
ŠUþa
   
EventHatMorph       Scratch-StartClicked

As you can see, if uses characters not even supported by the Scratch Forums!
See, down at the bottom, it says

Code:

EventHatMorph       Scratch-StartClicked

This is the http://wiki.scratch.mit.edu/images/When_Green_Flag_Clicked.png block.

D: Editing the Project From Notepad
*NOTE: This has produced an error whenever I tried it! If you get it to work, PLEASE tell how!*
  1) Open a new file in Notepad, preferably in a new window, not by pressing "New" in the file menu.
  2) Copy and paste the entire contents of the flag.sb file into the new window.
  3) Remove the bottom line of text:

Code:

EventHatMorph       Scratch-StartClicked


  4) Save, as test.sb.
  Make Sure It Is Called Test.sb, Not Test.txt!
  5) Open in Scratch. If you did everything like me, you will get this notice:

Could not read project; file may be damaged:
(Attempt to set the position of a PositionableStream out of bounds)

It seems it can't be edited in Notepad after all.  sad
But, there's hope! Try using Notepad++, which keeps byte information.  smile

Last edited by scimonster (2011-12-31 13:53:13)

Offline

 

#2 2011-05-31 10:21:41

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Editing Scratch Projects in Notepad

Works on macs too.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#3 2011-05-31 10:22:55

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Editing Scratch Projects in Notepad

Hardmath123 wrote:

Works on macs too.

Can you give me the instructions? Also, I thought Notepad was in Windows.  hmm

Offline

 

#4 2011-05-31 10:26:25

Taneb
Scratcher
Registered: 2009-07-07
Posts: 100+

Re: Editing Scratch Projects in Notepad

There're more text editors than Notepad, Scimonster

Offline

 

#5 2011-05-31 10:33:13

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Editing Scratch Projects in Notepad

Taneb wrote:

There're more text editors than Notepad, Scimonster

I know. Can I have the instructions and program to do it on a Mac?

Offline

 

#6 2011-05-31 11:09:04

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Editing Scratch Projects in Notepad

Actually you can open any software or project or file in notepad.

Offline

 

#7 2011-05-31 11:23:44

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Editing Scratch Projects in Notepad

It works for the opening part, but saving doesn't.
This is because notepad is a text editor and saves whatever file in an ASCII format, regardless of the bytes in it. Some bytes are then obviously lost. I think Visual Studio should do the trick  wink

EDIT
I tried it in Visual Studio 2010 Professional, and it worked!

I limited myself to simply changing the text in a costume, but I'm sure it'll work for more complicated editing too.

We just have to look in each object's saving method to see how it saves data, and we can change the bytes of the file accordingly.

Last edited by LS97 (2011-05-31 11:31:41)

Offline

 

#8 2011-05-31 11:57:50

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Editing Scratch Projects in Notepad

LS97 wrote:

It works for the opening part, but saving doesn't.
This is because notepad is a text editor and saves whatever file in an ASCII format, regardless of the bytes in it. Some bytes are then obviously lost. I think Visual Studio should do the trick  wink

EDIT
I tried it in Visual Studio 2010 Professional, and it worked!

I limited myself to simply changing the text in a costume, but I'm sure it'll work for more complicated editing too.

We just have to look in each object's saving method to see how it saves data, and we can change the bytes of the file accordingly.

Really?
I'll have to get this Visual Studio.

Offline

 

#9 2011-05-31 12:21:51

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Editing Scratch Projects in Notepad

scimonster wrote:

LS97 wrote:

It works for the opening part, but saving doesn't.
This is because notepad is a text editor and saves whatever file in an ASCII format, regardless of the bytes in it. Some bytes are then obviously lost. I think Visual Studio should do the trick  wink

EDIT
I tried it in Visual Studio 2010 Professional, and it worked!

I limited myself to simply changing the text in a costume, but I'm sure it'll work for more complicated editing too.

We just have to look in each object's saving method to see how it saves data, and we can change the bytes of the file accordingly.

Really?
I'll have to get this Visual Studio.

If you're willing to pay 600 pounds, go ahead.
Or you can register via Dreamspark, like I did. You get heaps of free stuff!

Offline

 

#10 2011-05-31 12:23:26

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: Editing Scratch Projects in Notepad

Try a hex editor (like XVI32) or Notepad++. Actually, I'll try one of those now.

Edit: Yes! I used XVI32 to remove the code for the green flag hat block, and when I opened it in Scratch, it wasn't there!  big_smile

Edit: Oh wait, I never actually opened the project. *facepalm* I opened it, but I got a "key not found" error. But there's probably more to it than just removing that bit. (I actually saw the Scratch Cat sprite on the stage in the preview when I went to open it, so it worked partially.)

Last edited by meowmeow55 (2011-05-31 12:31:58)


Yawn.

Offline

 

#11 2011-05-31 12:27:37

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Editing Scratch Projects in Notepad

LS97 wrote:

scimonster wrote:

LS97 wrote:

It works for the opening part, but saving doesn't.
This is because notepad is a text editor and saves whatever file in an ASCII format, regardless of the bytes in it. Some bytes are then obviously lost. I think Visual Studio should do the trick  wink

Really?
I'll have to get this Visual Studio.

If you're willing to pay 600 pounds, go ahead.
Or you can register via Dreamspark, like I did. You get heaps of free stuff!

yikes
Is there a free program that works well too?

Offline

 

#12 2011-05-31 12:32:52

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Editing Scratch Projects in Notepad

scimonster wrote:

LS97 wrote:

scimonster wrote:


Really?
I'll have to get this Visual Studio.

If you're willing to pay 600 pounds, go ahead.
Or you can register via Dreamspark, like I did. You get heaps of free stuff!

yikes
Is there a free program that works well too?

Maybe Visual Studio Express allows you to open the same files... download here

Offline

 

#13 2011-05-31 12:34:33

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: Editing Scratch Projects in Notepad

I tried to edit the costume name in XVI32, but I still got the key not found error. D:


Yawn.

Offline

 

#14 2011-05-31 12:42:24

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Editing Scratch Projects in Notepad

Ehm, let me just share a small tip with you:

Make sure you have some sort of backup copy of whatever project you're trying to edit. I accidentally messed up one of my projects, and good thing I had it shared on Scratch. Otherwise, would've lost it for sure.

Offline

 

#15 2011-05-31 12:44:46

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Editing Scratch Projects in Notepad

LS97 wrote:

Ehm, let me just share a small tip with you:

Make sure you have some sort of backup copy of whatever project you're trying to edit. I accidentally messed up one of my projects, and good thing I had it shared on Scratch. Otherwise, would've lost it for sure.

I added that up in the top.  smile

Offline

 

#16 2011-12-22 14:38:49

francis123
Scratcher
Registered: 2011-05-21
Posts: 7

Re: Editing Scratch Projects in Notepad

you can get a free trial for visual studio at http://www.microsoft.com/visualstudio/en-us.

does any body know other text editors that might work?

Offline

 

#17 2011-12-22 15:13:56

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Editing Scratch Projects in Notepad

Omg This Is Amazing


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#18 2011-12-22 15:57:11

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Editing Scratch Projects in Notepad

scimonster wrote:

*NOTE: This has produced an error whenever I tried it! If you get it to work, PLEASE tell how!*

The file format is rather complicated.  hmm  It was originally documented here, but it's a little out-of-date now. I'm writing a little Python parser for it, and I made a little wiki to document my findings.

The reason it produces an error when you do that is, I think, because the objects reference each other; so if you insert or delete objects in the file or change the order, it messes up those references.

With a lot of effort, one probably could edit Scratch files by hand, given a good hex editor —  but I'm not sure if it's worth it  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#19 2011-12-22 16:05:10

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Editing Scratch Projects in Notepad

For hex editors, I use Hex Fiend on a Mac.

meowmeow55 recommended XVI32 for Windows in this thread. I haven't tried it, but it might still help you (:


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#20 2011-12-22 16:10:58

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Editing Scratch Projects in Notepad

Also, the file format states the number of blocks in the project, as well as many other pieces of important data regarding the project (consult blob8108's wiki for more in depth information). In short, one block could change the entire file.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#21 2011-12-25 19:41:32

PowerBook
New Scratcher
Registered: 2011-12-25
Posts: 10

Re: Editing Scratch Projects in Notepad

Okay, modified the instructions for Mac OS X:

Instructions:

A: Creating the Project
  1) Open up Scratch.
  2) Delete the Scratch Cat, it will make it easier.
  3) Put a when green flag clicked block into the Stage.
  4) Save it as "flag" with no author or project notes.

B: Opening the Project
1. Open TextEdit
2. Go to the folder with "flag.sb"
3. Click "flag.sb"

C: Understanding the Project
This is the difficult part.
You should now have the file flag.sb open in TextEdit.
It should look like this, more or less:

Code:

ScratchV02  pObjSStch      c  c  c  c  c  c  c  c      c  
c  c  c  
c  c  c  c         history       >2011-5-31 15:52:59    save    flag        
2011-5-31 15:53:32    save    flag        
       platform       Win32       language       en       
os-version       NT       scratch-version       1.4 of 30-Jun-09           thumbnail#   x c  c         comment           author           âXéaÿ   c  c       ?ÿÿÿObjSStch   }c  c  c    c  c  c  c  c      ?ð          c  
 d <c  c  !    àh    ?ÿÿÿ       Stage       c  
   c      c  ¢c  c  c                 c  c  ¤c  c   d 2       background1"àh c    ð ´  l@Z@        c         popmc    € c  +  €    õÿ  Ta    c  c         Õ½
rïS#<$› â«sñUÚ_Ä`³©i¨’±åÅGáAó&íGÑaJo}p#a
DÎêó*ɧj‘ý%˜îµ9Ýèâ:`Dvpyµh¢EØgäJµl’zÞ†kŸqÈŽü!0â]}yßäq7M©¶ç©¸O–Œ‰‘i®OÙõ\< _PoïiNV$
òqÅY£g“¶™x²øÚh    £6ŽWkf)_¢F¼õòÈÊ­õ¢Î«Ä2êñÀ9«Q(VñI4+NÛ,º¾¨ì©¼ÑÝŒ¼.<K€YR'9]¬êÅq­­§)³ºÐö°¥?zQÈQÊ?k}ùçÖÓ¾¶¾UÕ¬õ¼*3‚Aõ@„/,òW՟ó¿õËtãœz z6‰?†8Ò$:Ãç’ο†ÀÏéQk%~: A8µ#–Sè/ÏVÂ*ÂêÑZêI"”5×<Ð5ì#J    ZîGØËwË
Öfêo±’*30x+ª<ôódá¿×¸Öö߬ïÍ)\#¨H«¯óRæpߺàÛé3öÌ$ÛòJ„É|òäç5á
á†èzôg¡,_Œ^=þtòçêÊç–é„ïàøùÔJ’Ù    7ûyöô–õÝù×ÿŽ—
ŠUþa
   
EventHatMorph       Scratch-StartClicked

As you can see, if uses characters not even supported by the Scratch Forums!
See, down at the bottom, it says

Code:

EventHatMorph       Scratch-StartClicked

This is the "When Flag Clicked" block.

D: Editing the Project From TextEdit
*NOTE: This has produced an error whenever I tried it! If you get it to work, PLEASE tell how!*
  1) Open a new file in Notepad, preferably in a new window, not by pressing "New" in the file menu.
  2) Copy and paste the entire contents of the flag.sb file into the new window.
  3) Remove the bottom line of text:

Code:

EventHatMorph       Scratch-StartClicked


  4) Save, as test.sb.
  Make Sure It Is Called Test.sb, Not Test.txt!
  5) Open in Scratch. If you did everything like me, you will get this notice:

Could not read project; file may be damaged:
(Attempt to set the position of a PositionableStream out of bounds)


It seems it can't be edited on the Mac after all.  sad

Offline

 

#22 2011-12-25 20:28:54

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: Editing Scratch Projects in Notepad

blob8108 wrote:

meowmeow55 recommended XVI32 for Windows in this thread

As I did in this one, waaay back when it was posted  tongue


Yawn.

Offline

 

#23 2011-12-31 09:22:42

killer64
Scratcher
Registered: 2010-11-23
Posts: 2

Re: Editing Scratch Projects in Notepad

this works on any computer everythere i dont know why some people think its not compatible just because there using a different program also i would never edit code with notepad i always do it in notepad++

Offline

 

#24 2011-12-31 11:36:38

cocolover76
Scratcher
Registered: 2011-10-09
Posts: 500+

Re: Editing Scratch Projects in Notepad

*smack face*
I learned this back from my SMW Galaxy days.
Notepad replaces NUL characters (look like (NUL) in text editors) with spaces when you save.


http://i.imgur.com/HfEPZ.gifhttp://i.imgur.com/pvKb6.png

Offline

 

#25 2011-12-31 11:38:27

ZeroLuck
Scratcher
Registered: 2010-02-23
Posts: 500+

Re: Editing Scratch Projects in Notepad

this topic is pointless.
You aren't able to edit a Scratch binary in Notepad.
lol


http://3.bp.blogspot.com/-oL2Atzp0Byw/T465vIQ36dI/AAAAAAAAADo/1vqL4PvhkM0/s1600/scratchdachwiki.png

Offline

 

Board footer