[Tutor] How to open IE7 to a certain URL?

Dick Moores rdm at rcblue.com
Fri Feb 29 19:24:50 CET 2008


At 08:40 AM 2/29/2008, Chris Fuller wrote:
>On Friday 29 February 2008 06:28, Dick Moores wrote:
> > I keep missing a certain weekly program on my local NPR station. My
> > idea is to record it using software I have, Easy Hi-Q Recorder. I can
> > set it to start recording when the program starts, 8pm, but I need to
> > have the program playing on my computer. The URL for the station's
> > audio is http://www.kuow.org/real.ram .
> >
> > I've got this so far:
> >
> > #!/usr/bin/env python
> > #coding=utf-8
> > import time
> > b = '20:00:00'
> > while True:
> >      a = time.strftime('%H:%M:%S')
> >      time.sleep(0.5)
> >      if a == b:
> >          print "TIME!"
> >          break
> >
> > Obviously, I need to replace the  'print "TIME"'  line with something
> > that will open IE7 to http://www.kuow.org/real.ram . But what?
> >
> > Thanks,
> >
> > Dick Moores
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
>
>
>You might consider passing the URL directly to the audio player.  This is
>usually all the web browser does for you, although its possible there's a
>different URL defined on that page each time, but then you could parse the
>page in python using urllib and re, or something similar.  Not only that,
>launching IE7 is a time and memory consuming activity, and definitely lacks
>grace.

Yes. Point taken.

>I dunno how your media player works, but this did the job for me (from the
>command prompt):
>
>"c:\Program Files\Real Alternative\Media Player Classic\mplayerc.exe"
>http://www.kuow.org/real.ram

Great!
"E:\Programs\Real Player\realplay.exe" http://www.kuow.org/real.ram
works fine at the command prompt!

>You could put this directly into your windows scheduler, and not use 
>python at
>all.  Start Menu>All Programs>Accessories>System Tools>Scheduled Tasks
>You'll get an option to set the command line at the end of teh wizard, if you
>check "show advanced options"
>
>You could have a python process running in the background that executed this
>command through the subprocess module, at the appointed time.  You could even
>use something like FireDaemon to turn it into a service.  But, it seems
>better to use the windows scheduler.

I'm having a lot of trouble with the windows scheduler. It wants a 
password, and there isn't one. In any event, I'd like to do this with 
Python, especially if I could have "a Python process running in the 
background." Would you mind giving me a start on the code for this?

Thanks,

Dick Moores




More information about the Tutor mailing list