On Saturday 29 January 2005 04:43, Matej Cepl wrote: > Hi, > > I have some mentionings of scripting KOffice applications (I am > interested mostly in KWord) with Python (or anything else), but > nothing specific enough to lead this poor non-CS into understanding > of how to do it. Can i ask couple of questions here to make things > (hopefully) more clear? > > 1) Does http://kde.geiseri.com/kscript-howto.html apply to the > current KOffice (KWord 1.3.4)? And an example on > http://www.kde.nl/doc/kate-scripting/? Do these two pages talk > about the same thing? > 2) Can anybody show me (preferably) Python scripts to do these two > following things: > a) My usual pet peeve in editors is missing equivalent of Emacs' > transpose-characters. I do not know whether it is missing in > KWord as well, but if yes, can you show me a script, which > would emulate (including binding the script to some shortcut like > Ctrl-T)? > b) if we had a character styles (like inline elements in > HTML), I would ask for a macro bound to key shortcut and assigning > one to the selection. However, I am afraid, that we don't have them > in KWord (so far?), so I would ask for macro that marks selected > text with bold and small caps. > > Can you help me, please? > > Thanks > > Matej Hello Matej! In fact, KOffice scripting is currently done only with DCOP... DCOP is basically a protocol, so there are various ways to use DCOP, either in your own KDE application (a library is included in kdelibs) or through a shell script, or you can use DCOP with python though!! You only need the python bindings for KDE (can be found in the kdebindings package) Kexi has some Python bindings that you can use directly in python. I'm not sure about the other KOffice components though. I would suggest to have a look at Kommander. Kommander is a tool for scripting KDE. Here are the links: http://www.kde-apps.org/content/show.php?content=12865 http://www.kde-apps.org/content/show.php?content=13125 You will find most of the information you need. In particular you should download the HTML docs....... they are not 100% complete but have still quite some info, in particular on using Kommander itself. Here is also more information on DCOP itself: http://www.koffice.org/developer/dcop http://www-106.ibm.com/developerworks/linux/library/l-dcop/index.html?ca=dgr-kdeml01KDEDCOP In particular the last one is probably quite interesting "to get started". You could also launch kword now and then launch kdcop and see what you find in the kword's interface. As you see there are probably more possibilities to get what you want although I guess you can expect difficulties every now and then. I'm also not completely sure how well your final DCOP script or application can be best integrated in KWord, but I guess it can be done somehow. Scripting KOffice is something I'm very interested in myself, but I have still to learn a lot as well. I would like to encourage you to try the above suggestion and keep us (the koffice user list) informed about how it is going. I will also try to help you on particular problems you might encounter. So to start I would very much suggest to learn about DCOP in the first place, look at the links I provided above, especially the one from IBM. Then if you feel comfortable you should probably install Kommander to help you to develop your particular "functionality". Good luck! And please keep us informed of your progress and your difficulties, Raphael ____________________________________ koffice mailing list koffice@mail.kde.org To unsubscribe please visit: https://mail.kde.org/mailman/listinfo/koffice