473,406 Members | 2,371 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,406 software developers and data experts.

How to detect open windows applications

Roy
How do I know within my python script if a specific windows
application is currently running in Windows 2000. Specifically, I
would like to know of MSWORD is running. I have the win32 package
installed. Thank you for your help.
Jul 18 '05 #1
5 5968
Roy wrote:
How do I know within my python script if a specific windows
application is currently running in Windows 2000. Specifically, I
would like to know of MSWORD is running. I have the win32 package
installed. Thank you for your help.


I'm sure there are other ways, but since no-one else has
replied yet, you could use wmi:

<code>
import wmi

c = wmi.WMI ()
for p in c.Win32_Process (Name="thunderbird.exe"):
print p.ExecutablePath

</code>

The example uses my wmi-wrapper module (Google for Python
WMI) but you can do WMI with raw pywin32 -- all the module
does is to make life a bit easier.

TJG
Jul 18 '05 #2
Hi !

Search the process.

@-salutations
--
Michel Claveau
Jul 18 '05 #3
Roy
That sounds like a good way...
How do I get a list of the process?

Michel Claveau - abstraction méta-galactique non trivial e en fuite perpétuelle. <un************@msupprimerlepoint.claveauPOINTco m> wrote in message news:<ci**********@news-reader4.wanadoo.fr>...
Hi !

Search the process.

@-salutations

Jul 18 '05 #4
gh
On Fri, Sep 17, 2004 at 06:37:02AM -0700, Roy wrote:
That sounds like a good way...
How do I get a list of the process?


That's possible with the win32 extensions. For a quick hack I often prefer to
interface command-line utilities like the pulist.exe and kill.exe from the M$
Resource Kit.

-- Gerhard
Jul 18 '05 #5
Roy
Michel Claveau - abstraction méta-galactique non trivial e en fuite perpétuelle. <un************@msupprimerlepoint.claveauPOINTco m> wrote in message news:<ci**********@news-reader4.wanadoo.fr>...
Hi !

Search the process.

@-salutations


I found it! (I think)
Is the following code reasonable?
......
import win32pdh

processes = win32pdh.EnumObjectItems(None, None, "Process", -1)
processList = list(processes[1])

app = 'WINWORD'
try:
index = processList.index(app)
print "Application %s is running." % app
except ValueError:
print "Application %s is not running." % app
......
I don't care about index, which indicates where it is in the process list.

Thank you for your help!
Jul 18 '05 #6

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

Similar topics

23
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
9
by: Paul Steele | last post by:
I am writing a C# app that needs to periodically poll for cdroms and usb storage device insertions. I've looked at the WMI functions but haven't found anything all that useful. The closest is...
12
by: Patrick Dugan | last post by:
I have an vb.net application that is a module that uses a "application.run" in the sub main to start. There is no form involved (just a system tray icon) How can you detect when the application...
8
by: Luke Matuszewski | last post by:
I have read all posts about how to detect that url have changed to new page and trigger the event handler then eg. function aidLogout(evt) { if(evt) { /* maybe via analyse of evt object i can...
0
by: Cachaca | last post by:
Hi. I tried to detect all running user applications (no all processes) and close them all. Obviously this is a usual function that has been existing in many programs. I used the ::EnumWindows...
3
by: =?Utf-8?B?SmltIFQ=?= | last post by:
I run WD and do not see any spyware detected at all. I then run any or all of Ad-Aware, Spybot and Zone Alarm and spyware is always detected. Obviously WD did not block any of these, and it...
1
by: Andy Bates | last post by:
Hi - Can't see another newsgroup to post this in; so thought I'd post here. I have a C# application that relies on multicast UDP to detect how many PCs the application is executing on...
36
by: Don | last post by:
I wrote an app that alerts a user who attempts to open a file that the file is currently in use. It works fine except when the file is opened by Notepad. If a text file is opened, most computers...
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: 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
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
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,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.