kword mit Python / DCOP steuern ?

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
abgdf

Hallo,

weiß jemand, wie man mit Python / DCOP Wörter in kword einfügt ?

In bash geht das so (die genaue appid von kword gegebenenfalls mit kdcop oder dcop herausfinden):

Code: Alles auswählen

appid=kword-11561
fs=$(dcopobject "`dcop $appid Document-0 textFrameSet 0`")
edit=$(dcopobject "`dcop $appid "$fs" startEditing`")
dcop $appid $edit insertText 'Hello world !'
Und in Perl (mit Modul von kdebindings3-perl):

Code: Alles auswählen

#!/usr/bin/perl -w
use strict;
use DCOP;
my $client = new DCOP;
$client->attach();
my $appid="kword-11561";
my $obj = $client->createObject($appid, "Document-0");
my $fs = $obj -> textFrameSet(0);
my $edit = $fs -> startEditing;
$edit -> insertText("Hallo Welt !");
Mit dcopext.py finde ich das dagegen schwierig.
Bisher bin ich so weit:

Code: Alles auswählen

#!/usr/bin/python
import sys
import dcopext
from kdecore import * 
aboutdata = KAboutData("dcop_test","dcop_test","1.0", "A test", KAboutData.License_GPL, "Copyright (C) 2005 ")
KCmdLineArgs.init(sys.argv,aboutdata)
app = KApplication() 
dcop = app.dcopClient()
kword = dcopext.DCOPObj("kword-11561", dcop, "Document-0")
fs=kword.textFrameSet(0)
Dann komm ich aber nicht weiter. Weiß jemand Rat ?

Viele Grüße
Antworten