Help - Search - Members - Calendar
Full Version: Is there a way to make this kind of application in xcode?
InsanelyMac Forum > Apple World > Mac Programming and Development
Espionage724
I want to make a simple window with a web browser in it that can only display 1 webpage I tell it to exactly like the Runescape Client on Runescape's website. Is this possible?
rollcage
QUOTE(Espionage724 @ Jul 17 2008, 11:04 PM) *
I want to make a simple window with a web browser in it that can only display 1 webpage I tell it to exactly like the Runescape Client on Runescape's website. Is this possible?

You could do basically the same thing in Safari 4 by saving a page as a web application, and no coding required! wink.gif
Espionage724
Wow...i'll have to definitely try that out lol

Just did it, very nice feature indeed smile.gif
~pcwiz
Yeah, its really easy to do using Xcode. Just use the Web View object in Interface Builder and using a bit of code you can set it to whatever web page you like smile.gif
alloutmacstoday
It's not as easy as pcwiz says, but if you look in the developer documentation for WebView, you can get it smile.gif
~pcwiz
It really is quite easy to do with AppleScript Studio, don't know about Cocoa though. Pretty simple, make an empty AppleScript studio project, open the NIB with Interface Builder, drag in a web view, name it and associate it with your main AppleScript, then open the Application AppleScript attributes and find the Application >> launched attribute, tick the checkbox, save the NIB then open your AppleScript and put this code in:

CODE
on launched
loadPage from "http://the-site-you-want-to-open.com"
end launched

on loadPage from theURL
    set URLWithString to call method "URLWithString:" of class "NSURL" with parameter theURL
    set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
    tell window "-whatever your window name is--"
        set mainFrame to call method "mainFrame" of object (view "--whatever your web view name is--")
    end tell
    call method "loadRequest:" of mainFrame with parameter requestWithURL
end loadPage
stroke
CODE
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://website.com"]];
[webView loadRequest:urlRequest];
alloutmacstoday
QUOTE(stroke @ Jul 25 2008, 07:00 PM) *
CODE
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://website.com"]];
[webView loadRequest:urlRequest];

Yeah, that's how I'd do it!

Obj-c is much better to do thigs in that AS S
~pcwiz
Cocoa is better obviously, but we all have to start somewhere right?
Colonel
QUOTE(~pcwiz @ Jul 25 2008, 11:11 PM) *
Cocoa is better obviously, but we all have to start somewhere right?

C# ftw...

*waits for flamewar*
skyhighmac
I wrote my app in applescript too. It is powerful for controlling other apps. I can do stuff in applescript, that MAMP (written in cocoa) cant do! True, applescript isn't a programming language per-se, but it is pretty powerful People can use what they wan.t Its personal preference. smile.gif
Espionage724
Ok just got Xcode and I;m quite confused on where to start. How do I make a Apple Script Studio thing?
skyhighmac
File > New Project, then click "AppleScript Application" under "Application" and click next & finish the wizard. Thats how you create a project, then open up MainMenu.nib and that opens up interface builder (which does just as its name implies). Then start scripting in (yourappname).applescript. To add new scripts, right click in your project, click on "New File" and then AppleScript Text File, and make sure it is added to your target (your main app in this case)
Mebster
I'm sure by now you guys have expressed your views on AppleScript clearly enough. So now this argument needs to stop.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.