RSS category feeds

RSS site feeds

Home arrow Script Collection
Script Collection

This is an example collection of Python Scripts for Windows. Most of them show, how to automate Windows Applications with COM. For the most scripts you need a Python distribution and the Pywin32 module, which is included in ActivePython.

If you want to post a script, article or news please use this link Post a Python script. Hint: For sytax highlighting place your code between the tags <pre> and </pre>

This section as RSS feed.



Show all processes with IDs Print E-mail

This script shows all running processes with their process IDs. It uses the wmi-class from Tim Golden. Please put it into the directory where you run this script from.

 
import wmi 
c = wmi.WMI () 
for process in c.Win32_Process ():
    print process.ProcessId, process.Name
Last Updated ( Thursday, 02 February 2006 )
 
Printwatcher Print E-mail

This script watches for activity at the installed printers and writes a logfile. It shows how much a user has printed on wich printer (works also with network printers).

But it has a proplem with counting the right amount of printed pages :-(

It uses the wmi-class from Tim Golden, which you can download from his webpages. Please put the wmi.py in the same directory where you run this script from.

 
import wmi
c = wmi.WMI ()
 
print_job_watcher = c.watch_for (
  notification_type="Creation",
  wmi_class="Win32_PrintJob",
  delay_secs=1
)
while 1:
  pj = print_job_watcher ()
  print "User %s has submitted %d pages to printer %s" % 
    (pj.Owner, pj.TotalPages, pj.Name)
Last Updated ( Thursday, 02 February 2006 )
 
Userdefined Commands in CATIA V5 Print E-mail

With "startCommand" one can start userdefined commands in the same way as you type the command in the command prompt in CATIA V5.

 
try:
    import win32com.client 
except:
    print "Oops PYwin32 from Marc Hammond needed" 
catapp = win32com.client.Dispatch("CATIA.application") 
#Attention: runs only if you have set TOOLS/CUSTOMIZE/OPTIONS to Englisch. 
catapp.StartCommand("Open") 
#Starts the "File open"-Menu 
#other examples: 
#catapp.StartCommand("What's This?") 
# Runs the Online-Help (Strg+F1)
#catapp.StartCommand("CompassDisplayOff") 
# Compass visible 
#catapp.StartCommand("CompassDisplayOn") 
# Compass invisible
Last Updated ( Friday, 20 March 2009 )
 
<< Start < Prev 11 12 13 14 15 16 17 18 19 20 Next > End >>

Results 91 - 95 of 98

Feedback

Recommended

Comments

  • The general Concept of the API hasn`t change so much. But the Concept of storing... More...
  • Very interesting article. I haven't seen much on V6 automation. I don't recogniz... More...
  • This will not work with either Outlook 2007 or 2010. The default usage is of Sim... More...
  • This script is very useful. If you are having trouble to utilize this script you... More...
  • this instant django site has been down for a while now, if anyone has the execut... More...

Login Form






Lost Password?
No account yet? Register

Exits

My prefered Python IDE

My prefered Python editor is Pyscripter from MMExperts. It is not only an editor. Pyscripter is a full Python IDE including (remote) debugging, a class browser, and all other nice helpers which a full featured IDE needs.

Do you have a script for me ?

Do you have an interesting Python script which does some really cool thing on Windows ? Please post them to this site. It`s very simple - simply copy&paste it to this form. No login is requiered.

Hint: For syntax highlighting and correct Python intendation place your code between html tags <pre> and </pre>.

My prefered web framework

My prefered web framework for developing web applications is Django. Django calls itself The web framework for perfectionists with deadlines. It is a really fast, scalable and (thanks Python) the sexiest web framework of the world.