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

#1 2009-08-15 16:20:17

filo5
Scratcher
Registered: 2008-01-08
Posts: 1000+

Text editor with saving

Yes, I made it! Text editor which supports saving files, with no limits of files saved!
UPDATE: YES! It deletes files now!

It uses two lists to store information; one is for text itself, and another one stores filenames and helps to locate the file in the first list. It's like this:

Code:

+-------------+------------------------------------------+
| File1       | Contents of file 1                       |
+-------------+------------------------------------------+
| File1       | Contents of file 1 continued             |
+-------------+------------------------------------------+
| File2       | Contents of file 2                       |
+-------------+------------------------------------------+
| File2       | Contents of file 2 continued             |
+-------------+------------------------------------------+

So, I worked on it about 30 mins to get everything working (saving, loading, allocation and editing functions). The long time took to figure out how to delete files (Made with reversed loop.) There's an advanced mechanism for editing. If you want to change a line, type this:

Code:

@[line number:number]%[new text:text]

So, if you'd want to change line 10 to "LOL", type this:

Code:

@10%LOL

This will take a while to process (because it needs to separate line number and text, that's the % character for. If you want to insert new line at a position, type this:

Code:

*[line number:number]%[new text:text]

So, inserting "The new line" at line 14 and moving all further lines below, type this:

Code:

*14%The new line

Deleting a line is simpler - just type:

Code:

^[line number:number]

So, to delete something at line 20, you'll type this:

Code:

^20

This version doesn't support deleting and overwriting files, but I'll work on it, if this project gets at least 2 love-its.

It doesn't save files permanently online. To save a file permanently, you have to download project, save a file and then save the project. If you do so, try closing Scratch, opening it again, opening this project and loading your previously saved file.

You can load intro file for more: Click green flag, then type in:

Code:

load
(enter)
intro
(enter)
no
(enter)

Here it is:
http://scratch.mit.edu/static/projects/filo5/649023_sm.png
Text editor with saving

Last edited by filo5 (2009-08-16 06:51:57)


Converting my Scratch projects to Python!

Offline

 

#2 2009-08-15 16:30:28

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Re: Text editor with saving

Neat...

I used something like this in ScratchText...

Offline

 

#3 2009-08-16 06:54:49

filo5
Scratcher
Registered: 2008-01-08
Posts: 1000+

Re: Text editor with saving

Just posted another version - ScratchNotepad.


Converting my Scratch projects to Python!

Offline

 

#4 2009-08-16 12:55:01

filo5
Scratcher
Registered: 2008-01-08
Posts: 1000+

Re: Text editor with saving

Just posted an update - fixed one severe bug, added overwriting files.


Converting my Scratch projects to Python!

Offline

 

Board footer