Author: Kurt Granroth Date: Subject: Web browser RPC question
On Jan 14, 2004, at 7:54 PM, Vaughn Treude wrote: > On Wednesday 14 January 2004 22:00, you wrote:
>> On Jan 14, 2004, at 2:21 PM, Vaughn Treude wrote:
>>> Here's a question for you web gurus: what I want to do is to control
>>> a web
>>> browser programmatically, specifically to tell an open browser window
>>> to open
>>> a new URL automagically rather than typing it in. It could be any
>>> Linux
>>> browser: Mozilla, Netscape, Galeon, Konqueror, Opera - maybe even
>>> Lynx.
>>
>> Konqueror is HUGELY scriptable.. as are quite a few KDE apps. They
>> use
>> the DCOP communication protocol which allows lightweight (but very
>> easy
>> to use) RPC. You can query and modify almost every property it has.
>> This includes such things as (but not limited to):
>>
>
> This is exactly what I was looking for - thanks! The article you
> mentioned
> looks good. One question, though: what does the "-1187" in your
> examples
> mean? Is this a universal thing? I've tried some of these commands
> and
> encountered the error "object not accessible." Do I need to replace
> the
> "-1187" with something llike a process ID of a running konqueror
> program?
> (That didn't seem to work either.) Or is it some sort of version
> string?
It is indeed related to the process ID. If you run 'kdcop' (the
graphical DCOP browser) or 'dcop' (the command line version), you'll
see that there are two types of object types. The first are for
applications like kwin and kicker that are singletons. Since only one
instance of them will ever exist, they are referenced only by name.
The second type are for applications that can have multiple running
versions (like konsole, konqueror, kbiff). These have the processed ID
prepended to the object name.
Try typing just 'dcop' on the command line and it will show you all the
top-level objects on your system.
Since there can be multiple running Konqueror instances, it's sometimes
tricky to find the one that you want. One way is to "know" what PID it
is from some external means (capture it when you start up, for
instance). Another way is to do something like:
#!/bin/sh
# find the first running instance of konqueror
konqueror=`dcop | grep konqueror`
dcop $konqueror $cmd