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

#1 2012-08-02 15:21:29

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

How to change Scratch Project file format?

I'm making a personal mod, and I want to change the file format from ".sb" to ".th"

How do I do this?


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#2 2012-08-02 15:35:41

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: How to change Scratch Project file format?

I think it's somewhere in ScratchFrameMorph. You have to edit multiple methods, I believe.

Offline

 

#3 2012-08-02 15:37:58

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

Re: How to change Scratch Project file format?

It's in multiple methods in the ScratchFileDialog and related morphs... not the ScratchFrame

Offline

 

#4 2012-08-02 15:44:21

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: How to change Scratch Project file format?

Oh, I saw something about .sb in ScratchFrame. It probably was in the save method or something, or I might have just been delusional  tongue
Ahh, here's what confused me.

Code:

saveScratchProjectNoDialog
    | t1 t2 |
    self closeMediaEditorsAndDialogs ifFalse: [^ self].
    projectName ifNil: [projectName _ ''].
    t1 _ self nameFromFileName: projectName.
    t2 _ ScratchFileChooserDialog getLastFolderForType: #project.
    t1 size = 0 | (t2 fileExists: t1 , '.sb') not ifTrue: [^ self saveScratchProject].
    ScratchFileChooserDialog lastFolderIsSampleProjectsFolder ifTrue: [^ self saveScratchProject].
    self updateLastHistoryEntryIfNeeded.
    projectName _ FileDirectory localNameFor: t1 , '.sb'.
    projectDirectory _ t2.
    self updateHistoryProjectName: projectName op: 'save'.
    self writeScratchProject

Last edited by chanmanpartyman (2012-08-02 15:49:13)

Offline

 

#5 2012-08-02 16:05:59

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

Re: How to change Scratch Project file format?

Yeah! I think it's best to change that too though, I missed it.
It basically says that if the project doesn't have a path yet, it saves it with SB, and wee don't want that.

Offline

 

#6 2012-08-03 14:04:54

KKdevelopers
New Scratcher
Registered: 2012-07-23
Posts: 67

Re: How to change Scratch Project file format?

code: ScratchFrameMorph>>saveScratchProject
fName _ (self nameFromFileName: fName), '.sb'. "Change .sb to your file extension"

ScratchFrameMorph>>saveScratchProjectNoDialog
(fName size = 0 | (dir fileExists: fName , '.sb') not) ifTrue: [^ self saveScratchProject]. "Again change .sb"
projectName _ FileDirectory localNameFor: (fName, '.sb').  "Once again change .sb"

ScratchFrameMorph>>nameFromFileName:
"Add this line change .sb to your file extension also change 3 to the length of your extension"
(s asLowercase endsWith: '.sb') ifTrue: [s _ s copyFrom: 1 to: s size - 3].

ScratchFileChooserDialog>>createScratchFileChooserFor:saving:
list _ ScratchFilePicker new extensions: #(scratch sb). "Add your extension"

Offline

 

#7 2012-08-03 21:48:07

suneel
Scratcher
Registered: 2012-01-27
Posts: 96

Re: How to change Scratch Project file format?

could u also add something that makes it into ane exe like export-exe- then people could develop software with it


Get Gangnam Style for free!
getgangnamforfree.weebly.co­­m

Offline

 

#8 2012-08-05 10:14:17

KKdevelopers
New Scratcher
Registered: 2012-07-23
Posts: 67

Re: How to change Scratch Project file format?

suneel wrote:

could u also add something that makes it into ane exe like export-exe- then people could develop software with it

maybe ask LS97 but you can use a scratch2exe it's on mediafire here;
http://www.mediafire.com/file/k9rteu5f70i0pyz/SB2EXE%20Pro.zip

Offline

 

Board footer