Automate webpage refresh

2005-12-01 Thread DarkBlue
I am trying to write a script (python2.3) which will be used 
with linux konqueror to retrive 2 webpages alternatively every 2 minutes.

My question is how can I send alternative args (the url)
to the same invocation of konqueror which I started with

def pipedreams(program, *args):
pid = os.fork()
if not pid:
  os.execvp(program, (program,) +  args)
  return os.wait()[0]  

pipedreams(konqueror,url1)

Obviously every time I call pipedreams I would open a new instance
which is exactly what I do not want.

My pseudocode :

  if timecounter == 60 :
 send url1 to konqueror to fetch  display
  elif timecounter == 120:
 send url2 to konqueror to fetch % display
 timecounter = 0 



Thanks for any hints
D.B.





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Automate webpage refresh

2005-12-01 Thread Carl Friedrich Bolz
Hi!

DarkBlue wrote:
 I am trying to write a script (python2.3) which will be used 
 with linux konqueror to retrive 2 webpages alternatively every 2 minutes.
 
 My question is how can I send alternative args (the url)
 to the same invocation of konqueror which I started with

This can be done using dcop, the KDE interprocess communication system.
  dcop can be used as a simple command line utility that sends messages
to running applications. The easiest way to use it is to just play
around with it on the commandline. For the konqueror usecase you would
do something like:

dcop konqueror-pid konqueror-mainwindow#1 openURL http://google.net;

this command can easily be executed with os.system.

Hope this gave some hints,

Carl Friedrich Bolz

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Automate webpage refresh

2005-12-01 Thread Mike Meyer
DarkBlue [EMAIL PROTECTED] writes:
 I am trying to write a script (python2.3) which will be used 
 with linux konqueror to retrive 2 webpages alternatively every 2 minutes.

 My question is how can I send alternative args (the url)
 to the same invocation of konqueror which I started with

 def pipedreams(program, *args):
 pid = os.fork()
 if not pid:
   os.execvp(program, (program,) +  args)
   return os.wait()[0]  

 pipedreams(konqueror,url1)

 Obviously every time I call pipedreams I would open a new instance
 which is exactly what I do not want.

No, that's not at all obvious. Some browsers will notice the
previously running instance, and tell it to load the page - basically
doing exactly what you want. Some take special flags to do that.

The webbrowser module abstracts all these differences out for
you. Since it has support for Konquerer, your code should look like this:

# Untested - I don't have Konquer installed.

import webbrowser
webbrowser.open(url1)

You may have to set the BROWSER environment variable to get it to find
Konquerer.

mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Automate webpage refresh

2005-12-01 Thread DarkBlue
Thanks for replies .
dcop , hmmm I had not thought of this .

D.B.


-- 
http://mail.python.org/mailman/listinfo/python-list