On Sunday 06 April 2008, Ian wrote:
> i want to create a script that opens a webpage, closes after 1 minute
> and opens a different page, this should happen over and over again?
> anyone any ideas how i should set this up?
>
For some sort of sales stand display thing by any chance? If so,
killing and restarting a heavyweight lump like a modern browser may be
somewhat wasteful and ugly/flickery (but has the definite advantage
that slow memory leaks won't build up).
Both firefox and konqueror have interfaces that allow you to load new
urls from the command line with an existing browser instance.
Unfortunately the simple mozilla-xremote-client that comes with firefox
doesn't seem to allow replacing contents of existing windows, nor does
kfmclient, they only seem to opening URLs into new tabs or new windows.
(I could be wrong!)
KDE konqueror's dcop interface allows you to replace existing windows,
though is a little trickier to use -
If you have KDE 3.x installed, try the following simple script (not
intended to be an example of good shell style), and note
it's relative smoothness compared to spawning&killing a browser instance
for each page.
I'd expect firefox could support a similar, probably dbus, interface one
day, if it doesn't already.
#!/bin/bash
# it's 4:00am! Don't let David write code!
konqueror &
KPID=$!
trap "kill $KPID" EXIT
# bodge to just wait for konqueror to finish starting.
sleep 5
# fullscreen.
dcop "konqueror-$KPID" konqueror-mainwindow#1 activateAction fullscreen
for i in \
http://penny-arcade.com/comic/ \
http://qwantz.com/ \
http://phdcomics.com/comics.php \
http://xkcd.com/
do
dcop "konqueror-$KPID" konqueror-mainwindow#1 openURL "$i"
sleep 10
done
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!