Re: How to deal with Java Script in None-GUI applications?
Re: How to deal with Java Script in None-GUI applications?
- Subject: Re: How to deal with Java Script in None-GUI applications?
- From: Nicko van Someren <email@hidden>
- Date: Wed, 1 Feb 2006 22:05:44 +0000
On 30 Jan 2006, at 18:36, Andrei Tchijov wrote:
In my case I do not think I need RunningLoop. I am not planing to
use URL Loading System. I think I should be OK with
[WebScriptObject -evaluateWebScript:] and [WebScriptObject -
callWebscriptMethod:WithArguments:]. Something along this line:
Yes, that should work just fine if you're not loading anything (and
probably even if you're loading stuff from files only). A general
way to bring JavaScript into your Mac applications is indeed pretty
handy, especially given that Apple tell us how we can access our
Objective C objects from within Javascript [1]. This means that you
can actually use JavaScript as the scripting basis for any Cocoa
application, not just web based ones.
As an aside, it also means you can access JavaScript from python on
the Mac is you PyObjC installed:
>>> from WebKit import WebView
>>> wso = WebView.alloc().initWithFrame_frameName_groupName_(((0,0),
(1,1)),"f","g").windowScriptObject()
>>> wso.evaluateWebScript_("p=37;q=41;p*q;")
1517.0
Cheers,
Nicko
[1] http://developer.apple.com/documentation/AppleApplications/
Conceptual/SafariJSProgTopics/Tasks/ObjCFromJavaScript.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden