Converting Scratch Projects to Mac OS X Applications
Assuming you have reasonable knowledge of Xcode and Interface Builder. If you don't, I'll try to clarify the details.
Create a Mac Application called iScratchProj
Here are your codes:
Classes:
iScratchProjAppDelegate.h
// Import Cocoa framework
#import <Cocoa/Cocoa.h>
// Import WebKit framework
#import <WebKit/WebKit.h>
@interface iBlobAppDelegate : NSObject <NSApplicationDelegate> {
// Create the window
NSWindow *window;
// Get the applet
IBOutlet id webView;
}
// Get the window
@property (assign) IBOutlet NSWindow *window;
@endiScratchProjAppDelegate.m
#import "iBlobAppDelegate.h"
@implementation iBlobAppDelegate
@synthesize window;
// When the application loaded...
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Add the applet to the screen
[webView stringByEvaluatingJavaScriptFromString:@"document.write(\"<#Paste here#>\")"];
}
@endNote: once you paste, you will get a floating oval in your code. Delete it like a character, and replace it with the Embed code of your project (open the project on the website, click Embed (under tags), and copy the second text). Then replace style='display:block;' with style='position:absolute;left:0;top:-25;'.
Interfaces:
MainMenu.xib/nib
Add a UIWebView to the window. Set the size to 482x362. Control-click from the blue cube (in the "MainMenu.xib - English" window) and drag it to the webview. In the popup black HUD window, click on the only choice (webView).
Once you have saved all three files, build and run. Ta-Da!
Last edited by Hardmath123 (2011-10-16 07:31:07)
Offline
If only there were a way to make one for pc...
Does this make it an application but you can still edit it? Or does it force presentation mode?
Last edited by Pecola1 (2011-10-16 09:00:18)
Offline
I'll make sure to try this on my mac in a bit.
Offline
Pecola1 wrote:
If only there were a way to make one for pc...
Does this make it an application but you can still edit it? Or does it force presentation mode?
Did you really just type that? *facepalm*
There are dozens of ways to make Scratch a “.exe” file, and as of now, there are only two ways to make it a “.app” file. And one of them’s downloader is broken.
Offline
Bump.
Offline
Very interesting.
Unfortunately, I do not have a Mac. :OOOOO
Offline
ProgrammingFreak wrote:
Very interesting.
![]()
Unfortunately, I do not have a Mac. :OOOOO
I'm not sure, but I think if you have Google Chrome and VB studio on Windows, you can replicate this with WebKit Chrome. No guarantees, though. Apple has much cooler apis.
Offline
Hardmath123 wrote:
ProgrammingFreak wrote:
Very interesting.
![]()
Unfortunately, I do not have a Mac. :OOOOOI'm not sure, but I think if you have Google Chrome and VB studio on Windows, you can replicate this with WebKit Chrome. No guarantees, though. Apple has much cooler apis.
I don't have the full studio.
Offline
Hardmath123 wrote:
Bump.
Offline
How does this work. (besides WebKIt...)
Offline
All it does is creates a tiny web browser window and opens the project on the Scratch site. Then it uses a bit of JavaScript to position the project in the window and hide scroll bars, so it looks like it's just the project.
Offline
That makes a lot more sense.
Offline
ProgrammingFreak wrote:
Hardmath123 wrote:
ProgrammingFreak wrote:
Very interesting.
![]()
Unfortunately, I do not have a Mac. :OOOOOI'm not sure, but I think if you have Google Chrome and VB studio on Windows, you can replicate this with WebKit Chrome. No guarantees, though. Apple has much cooler apis.
I don't have the full studio.
![]()
I bought proffesional. It was worth it, but express works the same.
Offline
Or you could go the easy way!
http://scratch.mit.edu/forums/viewtopic.php?id=82730
Offline
Hello all!
I export scratch games as .app's using BYOB. It works great. If you want to change the icon follow these easy instructions:
Right click on the .app file.
Then select "Show package contents."
Open the folder called "Contents"
Open the folder called "Resources"
Replace "BYOBApp.icns" with the icon you want
Tip's
––––––
-Make sure you replace the icon with a .icns file
-Make sure you call it "BYOBApp"
Offline
Hardmath123 wrote:
ProgrammingFreak wrote:
Very interesting.
![]()
Unfortunately, I do not have a Mac. :OOOOOI'm not sure, but I think if you have Google Chrome and VB studio on Windows, you can replicate this with WebKit Chrome. No guarantees, though. Apple has much cooler apis.
I have Visual Studio 2010 Ultimate (it's great when the help desk at school has awesome software that you can install for free) + Google Chrome + Windows 7. So I guess I could test this out...
EDIT: On second thought, I don't know a thing about XCode. The code you have typed there looks like Objective-C, but I can't be sure. I'm pretty sure the @interface syntax is unique to Obj-C...
Last edited by amcerbu (2012-04-12 02:42:00)
Offline
Won't this only work if you have an internet connection, and only after you upload your project online?
Offline
Yes.
Offline