version of JavaScript) a dominant role in QT by releasing the QT Script for
Applications toolkit (QSA), which is tightly integrated into their framework:
http://www.trolltech.com/products/qsa/
QSA plays the same role as VBA for Windows applications and is very easy to
use for QT/KDE programmers. QSA is released under a commercial license for
Linux/Unix (X11), Windows, and Mac platforms. In addition to that, QSA is also
licensed under the GNU GPL for free software development on the Linux/Unix
(X11) and Mac OS X platforms.
KJSEmbed
A very similar approach is the KDE JavaScript Engine KJSEmbed with bindings
for QT/KDE and the its interprocess communication mechanisms. You can find
KSJEmbed (which is licensed under the LGPL) and a lot of documentation at:
http://xmelegance.org/kjsembed
http://www.sourcextreme.com/presentations/KJSEmbed/
In Example C 2 you see how easy it is to write to a simple HTML browser with
JavaScript using this toolkit.
Example: C 2 Basic HTML browser with KJSEmbedd
#!/usr/bin/env kjscmd
var url = http://www.kde.org/ ;
if ( application.args.length )
url = application.args[0];
var mw = new KMainWindow();
var box = new QHBox( mw );
mw.setCentralWidget(box);
var view = Factory.createROPart( "text/html", box, "view" );
view.connect(view.child(0),
openURLRequest(const KURL&,const KParts::URLArgs&) ,
openURL(const KURL&) )
view.openURL( url );
mw.resize(650,500);
mw.show();
application.exec();
Many applications use other scripting languages of their choice (for example,
Perl/Python in Gimp/Gnumeric, Python in Scribus, Star Basic in OpenOffice,
Appendix C. Desktop automation and scripting
213
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved