RSS category feeds

RSS site feeds

More related

Thanks to...

Home arrow Script Collection
Script Collection

Examples for automating Windows applications via the Microsoft Component Object Model (COM), Win32API, PythonCOM and other interesting Python modules. Mainly developed with the Python Windows Extensions from Marc Hammond.

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.



Create image watermarks with PIL PDF Print E-mail
Image/Graphic
Another script from http://code.activestate.com/recipes/576818/ to create watermarks with images:
 
import Image, ImageEnhance, os
from os.path import join
 
def test():
    batch("/media/disk/pics", "/home/hasanat/outputfolder/", "/home/hasanat/watermark.png")
 
def batch(infolder, outfolder, watermark):
    mark = Image.open(watermark)
    for root, dirs, files in os.walk(infolder):
        for name in files:        try:
            im = Image.open(join(root, name))
            if im.mode != 'RGBA':
                im = im.convert('RGBA')
            layer = Image.new('RGBA', im.size, (0,0,0,0))
            position = (im.size[0]-mark.size[0], im.size[1]-mark.size[1])
            layer.paste(mark, position)
            Image.composite(layer, im, layer).save( join(outfolder, name))
        except Exception, (msg):
            print msg
 
if __name__ == '__main__':
    test()
 
Remote calls to a windows maschine PDF Print E-mail
WMI (Windows Management Instrumentation)
Here http://coreygoldberg.blogspot.com is another script to remotely get
  • Uptime
  • CPU Utilization
  • Available Memory
  • Memory Used
  • Ping
with Python and the wmi module. Simply drop the wmi module and the script into a directory and import it from a separate script or i.e. add a
get_cpu("maschine_name")
.
 
Export variables on win32 like in Unix PDF Print E-mail
Microsoft Windows
This script comes from Activestate. It exports a variable permanently on win32 - without needing to reboot the system. Note: pywin32 must be installed to run the script.

Use it like this:

 
import win32export
win32export.export("fooname" , "foovalue")
 
Adobe Photoshop automation PDF Print E-mail
Adobe Applications
The following script adjusts the brightness and contrast of an image via COM automation of Adobe Photoshop with Python and the win32com package.
 
Alarm clock on a Windows machine PDF Print E-mail
Microsoft Windows
Following example comes from Activestate (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/510387) and represents an alarm clock on Windows:
 
<< Start < Prev 1 2 3 4 5 6 7 8 9 10 Next > End >>

Results 16 - 20 of 95

Feedback

Comments

  • I tried this for outlook 2007 and it doesn't work, but python doesn't have an er... More...
  • I never understood why people don't include the import statements at the top of ... More...
  • Thanks friend! ;-) Work really apprecciated from italy! More...
  • y am I not being allowed to view more on catia scripts. More...
  • eval('item.%s' % attribute) should be written as getattr(item, attribute) More...

Login Form






Lost Password?
No account yet? Register

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.