Historical Note

This page was migrated from the original p-nand-q.com site which was last updated in 2015. The content has been preserved exactly as it was, with only formatting updated for modern browsers. Over the coming days and weeks, the content will be reviewed and may be updated for accuracy and relevance. If you find any issues, please contact me.

win32com and DevStudio

Here are some hints on using the Win32COM extensions for Python to write scripts, that automate the Microsoft Developer Studio (short DevStudio in the following). Thanks to Mark Hammonds excellent work, you don't need to bother with VB any longer and can automate DevStudio from PYTHON, THE BEST PROGRAMMING LANGUAGE IN THE WORLD.

Accessing the current instance of DevStudio

To access the current instance of Developer Studio, you have to write just two lines:

import win32com.client
app = win32com.client.Dispatch('MSDev.Application')

Now, app points to an Application object as described by the DevStudio object model.

How do I know the DevStudio object model ?

The object model is documented at the MSDN library. If they wouldn't change their links every two weeks, I would provide a direct link, but, alas, you'll have to lookup that yourself.

Sample Scripts

Commenting out the current text selection