473,395 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Automate webpage refresh

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.

Dec 1 '05 #1
4 3669
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

Dec 1 '05 #2
DarkBlue <no****@nixmail.com> 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 <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Dec 1 '05 #3
Thanks for replies .
dcop , hmmm I had not thought of this .

D.B.
Dec 2 '05 #4
For the benefit of anyone who reads this thread
here is a good tutorial :
(Following one long url which continues after the linux/)
http://www-128.ibm.com/developerworks/linux/
library/l-dcop/?ca=dgr-kdeml01KDEDCOP

D.B.

Dec 8 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Niko | last post by:
Hello, I want to retrieve the details of an SSL certificate of HTTPS websites, using openSSL, running on Windows 2003. This works fine as follows: openssl s_client www.somewebsite.com:443 >...
1
by: buzz | last post by:
How can I refresh one webpage from another? Many Thanks in Advance
1
by: Jack Nation | last post by:
I have one webpage with a javascript game that will not respond with a context menu when I right-click my mouse on it. However, when I open View and select "Refresh", the page will refresh. All...
0
by: deko | last post by:
I looking for way to reliably automate the process of upgrading users to a new version of an Access MDE application. I've tried this code a few times and it seems to work (gets custom menubars,...
3
by: GraVity via DotNetMonster.com | last post by:
Hello all I am new to asp.net or web programming I have a requirement, I have to submit a document to another server using my webpage, there is a perticular protocol for doing that. This protocol...
4
by: Eddie | last post by:
Hi All, How may I refresh my page, for exemple, when the user click a WebControls.Button on my form ? (Or on another frame ?) Thx for your help !
1
by: Lyners | last post by:
I am trying to figure out how to do this. I have created a form on a webpage that shows users that you can edit or delete. I have a hyperlink to another webpage that adds users. The "Add Users"...
4
by: batista | last post by:
Hello All, my prob. is that i have a web server, and i want it to send fresh data,whenver it is available(from sum other source), to a webpage. Now i used refresh, but i want to use an...
14
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I tried a google search but could not find anything. I am trying to cause one webpage to reload when a second web page is closed. The second webpage loads data into a session variable and when...
3
by: xtoughyx | last post by:
I work for a company which assigns me tasks via their own online portal/webpage which requires a log-in. These tasks are posted very irregularly, and there are frequently long periods in which no...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.