473,378 Members | 1,309 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,378 software developers and data experts.

open and shut case

Can python close a web-browser window it opened itself? The window in question
will be displaying a webpage that resides on the local computer, which is
running Windows 98. Knowing a way to do this would really help me out.

Peace
Jul 18 '05 #1
17 1557
Elaine Jackson wrote:
Can python close a web-browser window it opened itself? The window in question
will be displaying a webpage that resides on the local computer, which is
running Windows 98. Knowing a way to do this would really help me out.


Not easily. I guess something like this could work, if you have Mark
Hammonds win32 extensions installed:

(very untested)

import os, win32api
# start browser
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe", "iexplore.exe",
r"c:\blabla\hej.html")
# ...
# kill browser
win32api.TerminateProcess(pid, 0)
HTH

Erik
Jul 18 '05 #2
"Elaine Jackson" <el***************@home.com> writes:
Can python close a web-browser window it opened itself? The window in question
will be displaying a webpage that resides on the local computer, which is
running Windows 98. Knowing a way to do this would really help me out.


There are quite a few examples of automating IE with COM lying around
on Google and Google Groups if you know what to look for.
Unfortunately, COM is be rather obscure in many ways.

terms: IE, MSIE, Internet Explorer, COM, pywin32, win32all, ctypes

The win32 mailing list (whose name I forget -- sorry!) is a good
source.

PS. these days, your subject line sounds distinctly spammish
(especially since it's a woman posting the message to a
comp. newsgroup -- how likely can that be? ;-)
John
Jul 18 '05 #3
Thanks for the tips. The subject lines were meant to be humorous and hooky. I
guess I should know by now that it doesn't pay to attempt humor when there are
so many lower lifeforms around who can't imagine anything better to do than
peeing in the pool. C'est la vie, I guess. Anyway, thanks again.

Peace

"John J. Lee" <jj*@pobox.com> wrote in message news:87************@pobox.com...
| "Elaine Jackson" <el***************@home.com> writes:
|
| > Can python close a web-browser window it opened itself? The window in
question
| > will be displaying a webpage that resides on the local computer, which is
| > running Windows 98. Knowing a way to do this would really help me out.
|
| There are quite a few examples of automating IE with COM lying around
| on Google and Google Groups if you know what to look for.
| Unfortunately, COM is be rather obscure in many ways.
|
| terms: IE, MSIE, Internet Explorer, COM, pywin32, win32all, ctypes
|
| The win32 mailing list (whose name I forget -- sorry!) is a good
| source.
|
| PS. these days, your subject line sounds distinctly spammish
| (especially since it's a woman posting the message to a
| comp. newsgroup -- how likely can that be? ;-)
|
|
| John
Jul 18 '05 #4
John J. Lee wrote:
PS. these days, your subject line sounds distinctly spammish
(especially since it's a woman posting the message to a
comp. newsgroup -- how likely can that be? ;-)


What the .... ??! Was that supposed to be funny? The smiley
suggests you thought it was. It isn't. It's crude and rude.

Andrew
da***@dalkescientific.com
Jul 18 '05 #5
>> PS. these days, your subject line sounds distinctly spammish
(especially since it's a woman posting the message to a
comp. newsgroup -- how likely can that be? ;-)

What the .... ??! Was that supposed to be funny? The smiley
suggests you thought it was. It isn't. It's crude and rude.

Andrew


Cut him some slack, he may be really battered by spam and kinda
sensitive on the issue ;)

~Mik

--
Top-Bottom Programming never gets you where you wanted to go.
Bottom-Top Programming gets you where you never wanted to go.

while not life:
sleep((sleep.normal_time - 5h)); eat(mode=fast); pc_mainloop()
Jul 18 '05 #6
On Sun, 2004-09-12 at 17:54 +0000, Andrew Dalke wrote:
John J. Lee wrote:
PS. these days, your subject line sounds distinctly spammish
(especially since it's a woman posting the message to a
comp. newsgroup -- how likely can that be? ;-)


What the .... ??! Was that supposed to be funny? The smiley
suggests you thought it was. It isn't. It's crude and rude.


I took the wink to mean that the statement was to be taken as facetious.
I didn't see it as particularly rude or otherwise.

Regards,
Cliff

--
Cliff Wells <cl************@comcast.net>

Jul 18 '05 #7
Andrew Dalke <ad****@mindspring.com> writes:
John J. Lee wrote:
PS. these days, your subject line sounds distinctly spammish
(especially since it's a woman posting the message to a
comp. newsgroup -- how likely can that be? ;-)


What the .... ??! Was that supposed to be funny? The smiley
suggests you thought it was. It isn't. It's crude and rude.


Now *I'm* left thinking "What the.." . That went over my head... How
is it crude, or rude??

It just seemed funny that the very presence of a woman on this
newsgroup indicated spam to the sensitive spam-detection circuits my
brain has grown over the past few years.

If you want me to deconstruct the reasons why it seemed funny:

I suppose it fits the standard joke format, according to Vilayanur
Ramachandran (not sure the idea originates with him): a sudden
re-evaluation of the facts (it's not spam after all), and the
consequence turns out to be inconsequential (a perfectly valid
everyday post -- no harm has been done). The wink was mildly
self-mocking, I guess: The almost total absence of women from this
little virtual place must to some extent reflect badly on whatever
communities it comprises.

Maybe I should be pleased that I can't even imagine what it was you
thought I was saying...
John
Jul 18 '05 #8
On 2004-09-12, John J. Lee <jj*@pobox.com> wrote:
What the .... ??! Was that supposed to be funny? The smiley
suggests you thought it was. It isn't. It's crude and rude.
Now *I'm* left thinking "What the.." . That went over my head... How
is it crude, or rude??


I didn't understand the ferocity of this reaction either nor could I imagine
what impure thoughts he was imputing to your rather innocent brain. It was
as if you had made some sort of snide, lasciviously abject remark for
which you should justifiably be banned from decent society for the rest of
your life. This inspired me to re-read what you had written in order to
savor the utter degradation of your comment which had either passed over
or under the sea level of my moral sensitivities.

But whatever it was or was imagined to be, if anything, is beyond
me.
Jul 18 '05 #9
On Mon, 2004-09-13 at 14:30 +0000, Curt wrote:
This inspired me to re-read what you had written in order to
savor the utter degradation of your comment


LMAO!

--
Cliff Wells <cl************@comcast.net>

Jul 18 '05 #10
In article <ma**************************************@python.o rg>,
Erik Heneryd <er**@heneryd.com> wrote:
Elaine Jackson wrote:
Can python close a web-browser window it opened itself? The window in question
will be displaying a webpage that resides on the local computer, which is
running Windows 98. Knowing a way to do this would really help me out.


Not easily. I guess something like this could work, if you have Mark
Hammonds win32 extensions installed:

(very untested)

import os, win32api
# start browser
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe", "iexplore.exe",
r"c:\blabla\hej.html")
# ...
# kill browser
win32api.TerminateProcess(pid, 0)

Jul 18 '05 #11

"Cameron Laird" <cl****@lairds.us> wrote in message
news:nf************@lairds.us...
| Did this [some snipped code] meet your needs, Ms. Jackson?

Here's what it does:
import os, win32api
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",

"iexplore.exe",r"c:\blabla\hej.html")

Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
"iexplore.exe",r"c:\blabla\hej.html")
AttributeError: 'module' object has no attribute 'spawnlp'
Jul 18 '05 #12
On Sun, 26 Sep 2004 16:55:48 GMT, "Elaine Jackson"
<el***************@home.com> declaimed the following in
comp.lang.python:

"Cameron Laird" <cl****@lairds.us> wrote in message
news:nf************@lairds.us...
| Did this [some snipped code] meet your needs, Ms. Jackson?

Here's what it does:
import os, win32api
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
"iexplore.exe",r"c:\blabla\hej.html")

Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
"iexplore.exe",r"c:\blabla\hej.html")
AttributeError: 'module' object has no attribute 'spawnlp'


It seems the spawn family doesn't have the "search in PATH"
option... os.execlp does exist, but likely doesn't do what you want
either...
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #13
Dennis Lee Bieber wrote:
On Sun, 26 Sep 2004 16:55:48 GMT, "Elaine Jackson"
<el***************@home.com> declaimed the following in
comp.lang.python:

"Cameron Laird" <cl****@lairds.us> wrote in message
news:nf************@lairds.us...
| Did this [some snipped code] meet your needs, Ms. Jackson?

Here's what it does:

>import os, win32api
>pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",


"iexplore.exe",r"c:\blabla\hej.html")

Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
"iexplore.exe",r"c:\blabla\hej.html")
AttributeError: 'module' object has no attribute 'spawnlp'

It seems the spawn family doesn't have the "search in PATH"
option... os.execlp does exist, but likely doesn't do what you want
either...


It does, see http://docs.python.org/lib/os-process.html.
exec* replaces the current process, so you can't use that if you expect
it to return. I can't see why my code shouldn't work (though I'm not on
a Windows box so I can't test it).
Erik
Jul 18 '05 #14
Erik Heneryd wrote:
Dennis Lee Bieber wrote:
On Sun, 26 Sep 2004 16:55:48 GMT, "Elaine Jackson"
<el***************@home.com> declaimed the following in
comp.lang.python:

"Cameron Laird" <cl****@lairds.us> wrote in message
news:nf************@lairds.us...
| Did this [some snipped code] meet your needs, Ms. Jackson?

Here's what it does:
>> import os, win32api
>> pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
"iexplore.exe",r"c:\blabla\hej.html")

Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
"iexplore.exe",r"c:\blabla\hej.html")
AttributeError: 'module' object has no attribute 'spawnlp'

It seems the spawn family doesn't have the "search in PATH"
option... os.execlp does exist, but likely doesn't do what you want
either...


It does, see http://docs.python.org/lib/os-process.html.
exec* replaces the current process, so you can't use that if you expect
it to return. I can't see why my code shouldn't work (though I'm not on
a Windows box so I can't test it).


Forget about it. I just actually read the spawn* docs:

Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and
spawnvpe() are not available on Windows. New in version 1.6.
Erik
Jul 18 '05 #15
In article <ma**************************************@python.o rg>,
Erik Heneryd <er**@heneryd.com> wrote:
Erik Heneryd wrote:
Dennis Lee Bieber wrote:
On Sun, 26 Sep 2004 16:55:48 GMT, "Elaine Jackson"
<el***************@home.com> declaimed the following in
comp.lang.python:
"Cameron Laird" <cl****@lairds.us> wrote in message
news:nf************@lairds.us...
| Did this [some snipped code] meet your needs, Ms. Jackson?

Here's what it does:
>>> import os, win32api
>>> pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
"iexplore.exe",r"c:\blabla\hej.html")

Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
"iexplore.exe",r"c:\blabla\hej.html")
AttributeError: 'module' object has no attribute 'spawnlp'

It seems the spawn family doesn't have the "search in PATH"
option... os.execlp does exist, but likely doesn't do what you want
either...


It does, see http://docs.python.org/lib/os-process.html.
exec* replaces the current process, so you can't use that if you expect
it to return. I can't see why my code shouldn't work (though I'm not on
a Windows box so I can't test it).


Forget about it. I just actually read the spawn* docs:

Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and
spawnvpe() are not available on Windows. New in version 1.6.

Jul 18 '05 #16
My need couldn't be less urgent. My cat just died and I can't even begin to get
interested in fiddling with the computer right now.

Peace
"Cameron Laird" <cl****@lairds.us> wrote in message
news:18************@lairds.us...
| In article <ma**************************************@python.o rg>,
| Erik Heneryd <er**@heneryd.com> wrote:
| >Erik Heneryd wrote:
| >> Dennis Lee Bieber wrote:
| >>
| >>> On Sun, 26 Sep 2004 16:55:48 GMT, "Elaine Jackson"
| >>> <el***************@home.com> declaimed the following in
| >>> comp.lang.python:
| >>>
| >>>
| >>>> "Cameron Laird" <cl****@lairds.us> wrote in message
| >>>> news:nf************@lairds.us...
| >>>> | Did this [some snipped code] meet your needs, Ms. Jackson?
| >>>>
| >>>> Here's what it does:
| >>>>
| >>>>
| >>>>>>> import os, win32api
| >>>>>>> pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
| >>>>
| >>>>
| >>>> "iexplore.exe",r"c:\blabla\hej.html")
| >>>>
| >>>> Traceback (most recent call last):
| >>>> File "<pyshell#1>", line 1, in -toplevel-
| >>>> pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
| >>>> "iexplore.exe",r"c:\blabla\hej.html")
| >>>> AttributeError: 'module' object has no attribute 'spawnlp'
| >>>>
| >>>
| >>>
| >>> It seems the spawn family doesn't have the "search in PATH"
| >>> option... os.execlp does exist, but likely doesn't do what you want
| >>> either...
| >>>
| >>
| >> It does, see http://docs.python.org/lib/os-process.html.
| >> exec* replaces the current process, so you can't use that if you expect
| >> it to return. I can't see why my code shouldn't work (though I'm not on
| >> a Windows box so I can't test it).
| >
| >Forget about it. I just actually read the spawn* docs:
| >
| >Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and
| >spawnvpe() are not available on Windows. New in version 1.6.
| .
| .
| .
| This is silly. Ms. Jackson has asked for an *extremely* basic
| technique. I don't have a Win* keyboard within reach, and am
| reluctant to speculate, at this point. I'm certain, though,
| that her question has multiple simple answers. Ms. Jackson,
| how urgent is your need? Does someone else want to chip in
| with conclusive information?
Jul 18 '05 #17
Andrew Dalke <ad****@mindspring.com> wrote in message news:<Y2***************@newsread3.news.pas.earthli nk.net>...
John J. Lee wrote:
PS. these days, your subject line sounds distinctly spammish
(especially since it's a woman posting the message to a
comp. newsgroup -- how likely can that be? ;-)


What the .... ??! Was that supposed to be funny? The smiley
suggests you thought it was. It isn't. It's crude and rude.


http://www.winternet.com/~mikelr/flame6.html
--
CARL BANKS
Jul 18 '05 #18

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

Similar topics

1
by: manchi | last post by:
I am looking for an open source CASE tools that is used an althernative to Rational Rose, preferably a Java based tools. any recommendation? ~manchi
18
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
4
by: Nuno | last post by:
Is there any SQL Error? Or I have to use Select case in VB code to control SQL instead. Thank you for any ans. Nuno
1
by: corey_bunch | last post by:
Help! One of my main databases has been marked as suspect - the initial problem is that my disk had no space. So I moved some files, made some space, stopped & restarted the service, and now I...
5
by: Mike Cooper | last post by:
I have downloaded this from Allen Brownes access web page. Created a txt file from it then loaded it as a macro in my db. I cannot get it to run nor can I figure where to insert the name of the db...
5
by: elieli_132 | last post by:
Hi, My problem is the following: Made changes to code in form and closed the form. Now unable to open / design the form. - Tried copying and pasting - the new one does not open /display....
5
by: Jeff S | last post by:
I'm creating a new Windows Forms MDI application... How can I add cause the application to shut itself down after a period of ? I did this in an old COM/VB6 application and I had to have code...
7
by: Bob | last post by:
I have a winforms app written in Vs2005 Vb.Net, The setiings are to Enable the application Framework and I defined a splashform. Works fine if no errors occur. I do a checking on the mainform load...
5
by: Ian | last post by:
I am trying to: 1. Open a form on the external database 2. Enter a value in a text box on that form I have 1 above working OK using module form “The Access Web”, the module looks like this: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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...

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.