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

#176 2012-05-04 11:53:17

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

Re: Block Files

sparks wrote:

It's been a lot bugger than you thought, huh?  smile

I thought that's what always happens when making such things...  tongue


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

Offline

 

#177 2012-05-04 11:56:19

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

G0D_M0D3 wrote:

This. Is. Awesome.

I still love manually doing this, though. I learned more about coding that way, and I even made a few blocks for the now inactive (I think?) block library, but under a different name.

Thank you. I have worked a lot on this, and I appreciate your opinions. I love squeak and I definitely think you should explore squeak but sometimes you're not really in the mood for finding the control or motion section in the block spec array, am I right? That's a good reason to use my block importer.  smile

Offline

 

#178 2012-05-04 12:11:36

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Yeah, you're doing an amazing job!

I meant "buggier" by the way, sorry for the accidental mild language  tongue


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#179 2012-05-04 12:22:23

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

Yeah, you're doing an amazing job!

I meant "buggier" by the way, sorry for the accidental mild language  tongue

Yes, I understood that you meant 'buggier', but that didn't concern me too much. I too, make mistakes. Now, I'm just excited about the block uploader, once the site gets finished.

Offline

 

#180 2012-05-04 13:15:18

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Yeah! I have exams at the moment, so it's gonna be another three weeks before I will realistically have the time again to start working on the block site though. So many projects  tongue


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#181 2012-05-07 04:29:09

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Wow! I just saw that you updated the version file, dreamod! There's a lot of code there. Is the idea, then, that it checks the first line to work out whether it's a new version, then uses the rest of the code to actually update itself? Looks pretty neat!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#182 2012-05-07 08:56:46

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

Re: Block Files

Hi dreamod,

I do in fact use Xcode a lot, and believe it or not, I have actually tried to build a QuickLook plugin for Scratch! The problem was with UTI's. You see, every Mac app (and I think other platforms, but I'm not sure) has a unique UTI (Uniform Type Identifier) which identifies the creator of an application. For example Scratch has the UTI edu.mit.Scratch. My plugin was not identifying the Scratch UTI, which is why I think this could be problematic. If you, however, create a Mac application which generated Block files, with it's own UTI, I might be able to help. It might be as simple as an application which has a textarea for the code, and allows you to save and modify it. In fact, with this technology, block files can have custom file icons, not to mention all sorts of other goodies. I know a very good amount of Objective-C, Cocoa, and Quartz (the three powerful technologies you smash together in a QLp). I'll look into it again, anyway. The actual image rendering should be extremely easy.

Good luck,
Hardmath


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

Offline

 

#183 2012-05-07 09:41:39

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

Wow! I just saw that you updated the version file, dreamod! There's a lot of code there. Is the idea, then, that it checks the first line to work out whether it's a new version, then uses the rest of the code to actually update itself? Looks pretty neat!

Yes, first it reads the first line, and then it tells the user that it has successfully connected to the website, then when pressing yes (when prompted to proceed) it files-in all but the first line, which includes a method that reports a constant, which is going to be called to refer to the current version.

Offline

 

#184 2012-05-07 09:57:49

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

Hardmath123 wrote:

Hi dreamod,

I do in fact use Xcode a lot, and believe it or not, I have actually tried to build a QuickLook plugin for Scratch! The problem was with UTI's. You see, every Mac app (and I think other platforms, but I'm not sure) has a unique UTI (Uniform Type Identifier) which identifies the creator of an application. For example Scratch has the UTI edu.mit.Scratch. My plugin was not identifying the Scratch UTI, which is why I think this could be problematic. If you, however, create a Mac application which generated Block files, with it's own UTI, I might be able to help. It might be as simple as an application which has a textarea for the code, and allows you to save and modify it. In fact, with this technology, block files can have custom file icons, not to mention all sorts of other goodies. I know a very good amount of Objective-C, Cocoa, and Quartz (the three powerful technologies you smash together in a QLp). I'll look into it again, anyway. The actual image rendering should be extremely easy.

Good luck,
Hardmath

Thanks, I love Objective-C and I've started using it in Xcode a while ago (I made currency converter and a few others). I have a copy of the scratch VM in which I edited the plist with Property List Editor and added and replaced a few icons. It is set to have a certain icon for block files but however, they show up as a text document would, except showing 'BLOCK' on top. Do you know why this happens? I added this code to the plist under "document types"

Code:

...
<dict>
    <key>CFBundleTypeExtensions</key>
    <array>
        <string>block</string>
    </array>
    <key>CFBundleTypeIconFile</key>
    <string>BlockFiles.icns</string>
    <key>CFBundleTypeName</key>
    <string>Scratch Block File</string>
    <key>CFBundleTypeOSTypes</key>
    <array>
        <string>STam</string>
    </array>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
</dict>
...

Also, I changed the Bundle identifier to com.dreamod.blockImporter, was that foolish?
The Bundle version is still '3.8.14b7y'.
The Block Importer Application runs the 'block importer.image' file and the image file creates and saves block files. Does that count?

Offline

 

#185 2012-05-07 10:07:09

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

Re: Block Files

dreamod wrote:

Hardmath123 wrote:

Hi dreamod,

I do in fact use Xcode a lot, and believe it or not, I have actually tried to build a QuickLook plugin for Scratch! The problem was with UTI's. You see, every Mac app (and I think other platforms, but I'm not sure) has a unique UTI (Uniform Type Identifier) which identifies the creator of an application. For example Scratch has the UTI edu.mit.Scratch. My plugin was not identifying the Scratch UTI, which is why I think this could be problematic. If you, however, create a Mac application which generated Block files, with it's own UTI, I might be able to help. It might be as simple as an application which has a textarea for the code, and allows you to save and modify it. In fact, with this technology, block files can have custom file icons, not to mention all sorts of other goodies. I know a very good amount of Objective-C, Cocoa, and Quartz (the three powerful technologies you smash together in a QLp). I'll look into it again, anyway. The actual image rendering should be extremely easy.

Good luck,
Hardmath

Thanks, I love Objective-C and I've started using it in Xcode a while ago (I made currency converter and a few others). I have a copy of the scratch VM in which I edited the plist with Property List Editor and added and replaced a few icons. It is set to have a certain icon for block files but however, they show up as a text document would, except showing 'BLOCK' on top. Do you know why this happens? I added this code to the plist under "document types"

Code:

...
<dict>
    <key>CFBundleTypeExtensions</key>
    <array>
        <string>block</string>
    </array>
    <key>CFBundleTypeIconFile</key>
    <string>BlockFiles.icns</string>
    <key>CFBundleTypeName</key>
    <string>Scratch Block File</string>
    <key>CFBundleTypeOSTypes</key>
    <array>
        <string>STam</string>
    </array>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
</dict>
...

Also, I changed the Bundle identifier to com.dreamod.blockImporter, was that foolish?
The Bundle version is still '3.8.14b7y'.
The Block Importer Application runs the 'block importer.image' file and the image file creates and saves block files. Does that count?

Hmmm, no idea. I'm not sure you should edit the plist of Scratch, because the inner workings of Scratch file saving might be causing problems. It seems more reasonable to create your own application, maybe MacBlock or something.  smile


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

Offline

 

#186 2012-05-07 10:13:18

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

Hardmath123 wrote:

dreamod wrote:

Hardmath123 wrote:

Hi dreamod,

I do in fact use Xcode a lot, and believe it or not, I have actually tried to build a QuickLook plugin for Scratch! The problem was with UTI's. You see, every Mac app (and I think other platforms, but I'm not sure) has a unique UTI (Uniform Type Identifier) which identifies the creator of an application. For example Scratch has the UTI edu.mit.Scratch. My plugin was not identifying the Scratch UTI, which is why I think this could be problematic. If you, however, create a Mac application which generated Block files, with it's own UTI, I might be able to help. It might be as simple as an application which has a textarea for the code, and allows you to save and modify it. In fact, with this technology, block files can have custom file icons, not to mention all sorts of other goodies. I know a very good amount of Objective-C, Cocoa, and Quartz (the three powerful technologies you smash together in a QLp). I'll look into it again, anyway. The actual image rendering should be extremely easy.

Good luck,
Hardmath

Thanks, I love Objective-C and I've started using it in Xcode a while ago (I made currency converter and a few others). I have a copy of the scratch VM in which I edited the plist with Property List Editor and added and replaced a few icons. It is set to have a certain icon for block files but however, they show up as a text document would, except showing 'BLOCK' on top. Do you know why this happens? I added this code to the plist under "document types"

Code:

...
<dict>
    <key>CFBundleTypeExtensions</key>
    <array>
        <string>block</string>
    </array>
    <key>CFBundleTypeIconFile</key>
    <string>BlockFiles.icns</string>
    <key>CFBundleTypeName</key>
    <string>Scratch Block File</string>
    <key>CFBundleTypeOSTypes</key>
    <array>
        <string>STam</string>
    </array>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
</dict>
...

Also, I changed the Bundle identifier to com.dreamod.blockImporter, was that foolish?
The Bundle version is still '3.8.14b7y'.
The Block Importer Application runs the 'block importer.image' file and the image file creates and saves block files. Does that count?

Hmmm, no idea. I'm not sure you should edit the plist of Scratch, because the inner workings of Scratch file saving might be causing problems. It seems more reasonable to create your own application, maybe MacBlock or something.  smile

I copied the Scratch VM and then I edited the 'info.plist' in contents. Everything works fine if not better and in the menu bar it says Block Importer instead of Scratch as it does in some other mods where they just change the name of the application. I haven't noticed any differences except for the name changes I made. I'm going to post a link soon, I would be good if you took a look at that.

Offline

 

#187 2012-05-07 11:12:10

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

Re: Block Files

dreamod wrote:

Hardmath123 wrote:

dreamod wrote:


Thanks, I love Objective-C and I've started using it in Xcode a while ago (I made currency converter and a few others). I have a copy of the scratch VM in which I edited the plist with Property List Editor and added and replaced a few icons. It is set to have a certain icon for block files but however, they show up as a text document would, except showing 'BLOCK' on top. Do you know why this happens? I added this code to the plist under "document types"

Code:

...
<dict>
    <key>CFBundleTypeExtensions</key>
    <array>
        <string>block</string>
    </array>
    <key>CFBundleTypeIconFile</key>
    <string>BlockFiles.icns</string>
    <key>CFBundleTypeName</key>
    <string>Scratch Block File</string>
    <key>CFBundleTypeOSTypes</key>
    <array>
        <string>STam</string>
    </array>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
</dict>
...

Also, I changed the Bundle identifier to com.dreamod.blockImporter, was that foolish?
The Bundle version is still '3.8.14b7y'.
The Block Importer Application runs the 'block importer.image' file and the image file creates and saves block files. Does that count?

Hmmm, no idea. I'm not sure you should edit the plist of Scratch, because the inner workings of Scratch file saving might be causing problems. It seems more reasonable to create your own application, maybe MacBlock or something.  smile

I copied the Scratch VM and then I edited the 'info.plist' in contents. Everything works fine if not better and in the menu bar it says Block Importer instead of Scratch as it does in some other mods where they just change the name of the application. I haven't noticed any differences except for the name changes I made. I'm going to post a link soon, I would be good if you took a look at that.

Here's something to try: create a file with the "mod", then use Terminal to run this code

Code:

mdls filename

(where filename is the path to the file, like ~/Desktop/blah.block)

Copy and paste what happens, please. That will help check how the UTI-sharing worked. See, you need to formally "export" every custom UTI you make, which I'm not sure is happening.  smile


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

Offline

 

#188 2012-05-07 11:24:24

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

Ok.

Code:

kMDItemContentCreationDate     = 2012-05-07 17:22:40 +0200
kMDItemContentModificationDate = 2012-05-07 17:22:40 +0200
kMDItemContentType             = "dyn.ah62d4um4ge80e5dtqrzu"
kMDItemContentTypeTree         = (
    "com.apple.traditional-mac-plain-text",
    "public.plain-text",
    "public.text",
    "public.data",
    "public.item",
    "public.content"
)
kMDItemDisplayName             = "move () steps.block"
kMDItemFSContentChangeDate     = 2012-05-07 17:22:40 +0200
kMDItemFSCreationDate          = 2012-05-07 17:22:40 +0200
kMDItemFSCreatorCode           = "R*ch"
kMDItemFSFinderFlags           = 0
kMDItemFSHasCustomIcon         = 0
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 0
kMDItemFSIsStationery          = 0
kMDItemFSLabel                 = 0
kMDItemFSName                  = "move () steps.block"
kMDItemFSNodeCount             = 0
kMDItemFSOwnerGroupID          = 20
kMDItemFSOwnerUserID           = 501
kMDItemFSSize                  = 10696
kMDItemFSTypeCode              = "TEXT"
kMDItemKind                    = "Scratch Block File"
kMDItemLastUsedDate            = 2012-05-07 17:22:40 +0200
kMDItemUsedDates               = (
    "2012-05-07 00:00:00 +0200"
)

Offline

 

#189 2012-05-08 09:24:37

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

Re: Block Files

Ah, ok, so you're not creating your own UTI (it would show up in front of kMSItemContentType). "dyn" codes are generic for unrecognized UTI's. To get a custom UTI working, you need to export it.

P.S. I'm glad you blanked out your name, I just realized this morning the code has your username and felt a bit bad about making you post it...

EDIT: Exporting URI's: Apple reference

Last edited by Hardmath123 (2012-05-08 09:27:43)


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

Offline

 

#190 2012-05-08 10:21:59

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

Hardmath123 wrote:

Ah, ok, so you're not creating your own UTI (it would show up in front of kMSItemContentType). "dyn" codes are generic for unrecognized UTI's. To get a custom UTI working, you need to export it.

P.S. I'm glad you blanked out your name, I just realized this morning the code has your username and felt a bit bad about making you post it...

EDIT: Exporting URI's: Apple reference

Ok, that's good to know, I hope I get somewhere with this. My Mac certainly does treat it as a plain text file.
Thanks for the link, I'll read it and try to see if I can make a new UTI type.
P.S.
I am VERY careful about personal information, and I know how to censor. I wouldn't even tell you that I'm a guy... whoops, well, you get the point.

Offline

 

#191 2012-05-08 17:10:39

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

If you need more than one hosted text file, just let me know, btw  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#192 2012-05-09 09:51:11

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

If you need more than one hosted text file, just let me know, btw  smile

Thanks, you are very nice. I would like to help you too, so I have an idea for the block library website that I would like to share. I animated a picture to show how the website might look. Please take a look at this: http://s11.postimage.org/3ofogtew1/Idea_For_Block_Library_Website.png
As seen on the third 'draggable?' block, when one of those areas gets clicked, then it should expand and show more detail including a download link. At the bottom you would have blocks to mark pages. Of course, I do not expect you to get this done anytime soon but I think you should consider this layout. The blocks would be replaced by other ones. I didn't feel like creating a bunch of new blocks, export them, and copy them into the picture so I just copied the two top blocks.

Offline

 

#193 2012-05-09 12:12:30

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Thanks, Dreamod! I'm in a Cafe right now and for some reason the internet won't let me see the image, so I'll take a look in a bit when I get home, the idea sounds amazing though!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#194 2012-05-09 13:43:38

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

Re: Block Files

dreamod wrote:

I animated a picture to show how the website might look. Please take a look at this: http://s11.postimage.org/3ofogtew1/Idea_For_Block_Library_Website.png
As seen on the third 'draggable?' block, when one of those areas gets clicked, then it should expand and show more detail including a download link. At the bottom you would have blocks to mark pages.

Looks nice.  smile  I'd suggest not having the different coloured page numbers -- makes them look like different block categories at first glance. Cool idea, though!  smile


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

Offline

 

#195 2012-05-09 13:58:28

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

blob8108 wrote:

dreamod wrote:

I animated a picture to show how the website might look. Please take a look at this: http://s11.postimage.org/3ofogtew1/Idea_For_Block_Library_Website.png
As seen on the third 'draggable?' block, when one of those areas gets clicked, then it should expand and show more detail including a download link. At the bottom you would have blocks to mark pages.

Looks nice.  smile  I'd suggest not having the different coloured page numbers -- makes them look like different block categories at first glance. Cool idea, though!  smile

Ok, I guess I could agree with you on that one.

Offline

 

#196 2012-05-09 14:49:55

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Wow! I had a look, it's a very good layout idea! I like the expanding idea, since it will keep things nice and tidy. Something I was considering was a download count and love-it system for the blocks too, what do people think?


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#197 2012-05-09 15:13:14

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

Wow! I had a look, it's a very good layout idea! I like the expanding idea, since it will keep things nice and tidy. Something I was considering was a download count and love-it system for the blocks too, what do people think?

Actually, it never crossed my mind to have a love-it or download count feature. That sounds good though, and I can't wait to see the finished block library website. The download section might confuse people if you don't have some sort of tab for the block importer, I'll give you permission to use it. Actually, I'd be honored if you had it on your site.

Offline

 

#198 2012-05-10 12:40:33

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

I would like to make it so that if you drag a block into the block editor dialog you insert 'self ' , (aMorph selector copyReplaceAll: ':' with: ': ()'), I edited the acceptDroppingMorph: aMorph event: evt method but it seems that that blocks treat the dialog as if it were the World, can somebody help me make blocks embed into DialogBoxMorphs?

Offline

 

#199 2012-05-12 14:16:05

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Dreamod, I'm starting work on the block sharing page on the block library! It would be great if you could post a sample code for a stack block with the spec "block name", the code "block code" and soforth so that I can get the form to output a complete block file, ready for importing!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#200 2012-05-12 14:53:55

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Block Files

sparks wrote:

Dreamod, I'm starting work on the block sharing page on the block library! It would be great if you could post a sample code for a stack block with the spec "block name", the code "block code" and soforth so that I can get the form to output a complete block file, ready for importing!

Could we fix the problem where you can upload blocks for categories that don't exist in that mod?  (i.e., a Files block for Scratch)

Offline

 

Board footer