[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: How do I drive Konqueror from script?
From:       David Faure <faure () kde ! org>
Date:       2010-09-20 10:51:13
Message-ID: 201009201251.14111.faure () kde ! org
[Download RAW message or body]

On Friday 09 July 2010, Krzysztof Żelechowski wrote:
> I am looking for a way to write a script for the SMS feature in
> KAddressBook. The script should go like this (in AppleScript pseudocode)
> 
> const kGateURL = "..."
> 
> on run
> tell Konqueror
> navigate to kGateURL
> tell current document
> tell form 0
> set value of control "receiver" to %N
> set value of control "message" to contents of file %F
> reveal
> end tell
> end tell
> end tell
> end run
> 
> Please give me some hints how I could actually implement this tidbit.

This can be done with the evalJS dbus call.

Here is an excerpt from a script of mine which scripts a webpage too:

url=....
appid=`kstart --service konqueror.desktop --windowclass konqueror --url "$url"`
# kstart ensures konqueror is launched and ready, but not that khtml finished loading
objid=''
while test -z "$objid"; do
   # TODO: timeout?
   sleep 1
   i=1
   objid="/KHTML/$i/widget"
   if test "`qdbus $appid $objid url`" != "$url"; then
     objid=''
   fi
done

# Assume KWallet filled in the login page.

qdbus $appid $objid evalJS 'document.forms[0].submit()'

sleep 1

qdbus $appid $objid evalJS '.....'

-- 
David Faure, faure@kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic