Web browser RPC question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Vaughn Treude
Date:  
Subject: Web browser RPC question
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):
>
> o Current URL browsing
> o All menu items
> o Most 'widgets' associated with the window ("forms" and the like)
> o Bookmarks
> o History
> o Nearly anything else that Konqueror can do
>


Kurt,

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?

Vaughn


> This is accessible via shell scripts using the 'dcop' command or
> through Python (with PyKDE, I think) or C or C++. If you want to
> browse through which DCOP functions Konqueror (or any other KDE app)
> supports, just fire up the 'kdcop' command. It is a graphical browser
> of all supported functions.
>
> There is a good into article on DCOP scripting in general here:
> http://www.linux-magazine.com/issue/36/KDE_Scripting_DCOP.pdf
>
> A few random Konqueror DCOP commands:
>
> # open a new browser at google.com
> % dcop konqueror-1187 default createBrowserWindow http://www.google.com
>
> # find out the current browsing history
> % dcop konqueror-1187 KonqHistoryManager allURLs
>
> # create a new tabbed window, open up google.com in it, activate the
> original tab, open up kde.org in it
> % dcop konqueror-1187 konqueror-mainwindow\#1/action/newtab activate
> % dcop konqueror-1187 konqueror-mainwindow\#1 openURL
> http://www.google.com
> % dcop konqueror-1187 konqueror-mainwindow\#1/action/activateprevtab
> activate
> % dcop konqueror-1187 konqueror-mainwindow\#1 openURL http://www.kde.org
>
> # select all the text on a specific open page, copy it to the
> clipboard, paste it to a 'kate' editor window
> % dcop konqueror-1187 html-widget6 selectAll
> % dcop konqueror-1187 konqueror-mainwindow\#1/action/copy activate
> % dcop kate ClipboardInterface\#1-1 paste
>
> Hopefully you get the picture. Almost any operation that can be done
> via menus (or behind the scenes) can be scripted using DCOP. And this
> holds true for more than just Konqueror... check kdcop on KMail and
> Konsole just for fun :-)
>
> Have fun!
> Kurt
>
>
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss