os dejo este código demostrativo, escrito por el usuario milio del foro gambas-it, para enviar texto directamente a el editor Kate (KDE) mediante el recurso DBUS.
Se necesita activar el componente gb.dbus .
Private $oKate As DBusProxy
Private $oTimer As Timer
Private $iCont As Integer
Private $oProc As Process
Public Sub _new()
$oTimer = New Timer As "Wait"
$oTimer.Delay = 500
End
Public Sub Form_Open()
End
Public Sub Kate_Kill()
Button2.Enabled = False
Button1.Enabled = True
Message.Info("Cierre de Kate")
End
Public Sub Button1_Click()
Dim oProc As Process
Last.Enabled = False
$oProc = Exec ["kate"] For Read As "Kate"
$iCont = 0
$oTimer.Start
End
Public Sub Wait_Timer()
Try $oKate = DBus["org.kde.kate-" & $oProc.Id]["/Kate/Document/1"]
If Not Error Then
$oTimer.Stop()
Button2.Enabled = True
Return
Endif
Inc $iCont
If $iCont = 10 Then
$oTimer.Stop()
Message.Error("Imposible conectarse a DBus")
Button1.Enabled = True
Endif
End
Public Sub Button2_Click()
$oKate.setText(Editor1.Text)
End
Private $oTimer As Timer
Private $iCont As Integer
Private $oProc As Process
Public Sub _new()
$oTimer = New Timer As "Wait"
$oTimer.Delay = 500
End
Public Sub Form_Open()
End
Public Sub Kate_Kill()
Button2.Enabled = False
Button1.Enabled = True
Message.Info("Cierre de Kate")
End
Public Sub Button1_Click()
Dim oProc As Process
Last.Enabled = False
$oProc = Exec ["kate"] For Read As "Kate"
$iCont = 0
$oTimer.Start
End
Public Sub Wait_Timer()
Try $oKate = DBus["org.kde.kate-" & $oProc.Id]["/Kate/Document/1"]
If Not Error Then
$oTimer.Stop()
Button2.Enabled = True
Return
Endif
Inc $iCont
If $iCont = 10 Then
$oTimer.Stop()
Message.Error("Imposible conectarse a DBus")
Button1.Enabled = True
Endif
End
Public Sub Button2_Click()
$oKate.setText(Editor1.Text)
End