Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / August 2007



Tip: Looking for answers? Try searching our database.

Using Objective-C From JavaScript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon Slavin - 27 Aug 2007 19:32 GMT
I'm really not very good at this.  I've written quite a lot of stuff in
Cocoa but it has all been entire Applications and now I need to write a
plugin or a framework or something.  I'm following the instructions on
this page

http://developer.apple.com/documentation/AppleApplications/Conceptual/Safar
iJSProgTopics/index.html

and it gets into a a nice example involving BasicAddressBook and talks
about editing a .m file.  But what kind of project is this ?  Should I
create it in Xcode by using 'Cocoa Application' or 'Cocoa Bundle' or is it
a library or what ?  It's not an application, in that 'main' does nothing
and it has no interface, so I guess the application options are wrong.

I assume I should link to WebKit.framework.  But the page mentions
WebScriptObject.h .  Should I be importing that somewhere, or is it part
of Cocoa or WebKit.framework or something else that means it will be
implicitly incorporated ?

Simon.
Signature

http://www.hearsay.demon.co.uk

Tom Harrington - 27 Aug 2007 21:31 GMT
In article <fav5ca$r3g$1$8300dec7@news.demon.co.uk>,
Simon Slavin <slavins.delete.these.four.words@hearsay.demon.co.uk>
wrote:

> I'm really not very good at this.  I've written quite a lot of stuff in
> Cocoa but it has all been entire Applications and now I need to write a
[quoted text clipped - 9 lines]
> a library or what ?  It's not an application, in that 'main' does nothing
> and it has no interface, so I guess the application options are wrong.

That documentation applies if you're writing a Mac OS X application that
uses WebKit for some or all of its UI.  Cocoa Application, or
document-based application, or whatever, is a decision that depends on
what the application does.  The Objective-C objects that can then be
used from JavaScript are whatever is in your application that's
appropriate to the WebKit portion of the app.

Are you looking to write a plugin that would work in Safari?  That
sounds like it might be what you mean but it's not clear.

Signature

Tom "Tom" Harrington
MondoMouse makes your mouse mightier
See http://www.atomicbird.com/mondomouse/

Simon Slavin - 28 Aug 2007 02:33 GMT
On 27/08/2007, Simon Slavin wrote in
message
<fav5ca$r3g$1$8300dec7@news.demon.co.uk>:

> I'm following the instructions on
> this page

http://developer.apple.com/documentation/AppleApplications/Conceptual/Saf

ar iJSProgTopics/index.html

> and it gets into a a nice example involving BasicAddressBook and talks
> about editing a .m file.  But what kind of project is this ?  Should I
> create it in Xcode by using 'Cocoa Application' or 'Cocoa Bundle' or is
> it a library or what ?  It's not an
application, in that 'main' does
> nothing and it has no interface, so I
guess the application options are
> wrong.
>
> I assume I should link to WebKit.framework.  But the page mentions
> WebScriptObject.h .  Should I be importing that somewhere, or is it part
> of Cocoa or WebKit.framework or something else that means it will be
> implicitly incorporated ?

Tom
asked:

> Are you looking to write a plugin that would work in Safari?
That
> sounds like it might be what you mean but it's not clear.

Yes, that's it.  Safari and anything else that uses WebKit.  It doesn't
need to have any free-standing abilities at all, I'm just providing an
interface between JavaScript and something I can't do in JavaScript.  And
it doesn't need to be a fully-fledged View handler because it doesn't draw
anything on the web page, it just accepts text data from JavaScript,
processes it, and returns the results as text.

Simon.
Signature

http://www.hearsay.demon.co.uk

Tom Harrington - 28 Aug 2007 04:15 GMT
In article <favu1t$p6c$1$8300dec7@news.demon.co.uk>,
Simon Slavin <slavins.delete.these.four.words@hearsay.demon.co.uk>
wrote:

> > Are you looking to write a plugin that would work in Safari?  That
> > sounds like it might be what you mean but it's not clear.
[quoted text clipped - 5 lines]
> anything on the web page, it just accepts text data from JavaScript,
> processes it, and returns the results as text.

Some quick searching at developer.apple.com turns up "Web Kit Plug-In
Programming Topics" at
<http://developer.apple.com/documentation/InternetWeb/Conceptual/WebKit_P
luginProgTopic/index.html>, and some sample code at
<http://developer.apple.com/samplecode/WebKitPluginStarter/index.html>.

The "readme" in the sample code steps you through setting up an Xcode
project for such a plugin.

Signature

Tom "Tom" Harrington
MondoMouse makes your mouse mightier
See http://www.atomicbird.com/mondomouse/

Simon Slavin - 29 Aug 2007 22:25 GMT
[Sorry, for some reason my client won't let me thread this correctly.]

Tom: thanks for those projects, but they're for 'Views': thing that result
in something that's shown on your web page.  They include lots of stuff
that isn't needed if all you're doing is talking to JavaScript.

David: That 'Birthdays' plugin seems to be what I needed.  I hadn't
thought of looking through the widgets since I'm not writing a widget but
the plug-in is as simple as I need to go.  Thanks very much.

Dammit.  Now I have to actually write the thing.

Simon.
David Phillip Oster - 28 Aug 2007 03:53 GMT
In article <fav5ca$r3g$1$8300dec7@news.demon.co.uk>,
Simon Slavin <slavins.delete.these.four.words@hearsay.demon.co.uk>
wrote:

> I'm really not very good at this.  I've written quite a lot of stuff in
> Cocoa but it has all been entire Applications and now I need to write a
[quoted text clipped - 16 lines]
>
> Simon.

It sounds like you want to download the .dmg from
http://developer.apple.com/samplecode/Birthdays/ and open and edit the
enclosed Xcode project
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.