Questions tagged [win32com]

win32com is a Python module to interact with Windows COM components. It is part of the Python for Win32 (pywin32) project by mhammond.

win32com is a Python module to interact with windows COM components. It is part of the Python for Win32 (pywin32) extensions project by mhammond, which provides access to many of the Windows APIs from Python.

The Python COM package can be used to interface to almost any COM program (such as the MS-Office suite), write servers that can be hosted by any COM client (such as Visual Basic or C++), and has even been used to provide the core ActiveX Scripting Support.

1868 questions
14
votes
4 answers

Error while working with excel using python

while my script is updating one excel same time if i am going to do any other work manually with another excel error occurs i am using dispatch from win32com.client import Dispatch excel = Dispatch('Excel.Application') excel.Visible …
sagar
  • 1,375
  • 5
  • 20
  • 38
13
votes
8 answers

Outlook using python win32com to iterate subfolders

I have the following code which gets me the inbox of my shared folder, and all of the emails inside. This code works great and will print the subject of the last email. outlook =…
nico
  • 179
  • 2
  • 3
  • 9
13
votes
3 answers

Accessing unregistered COM objects from python via a registered TLB

I have three pieces of code that i'm working with at the moment: A closed source application (Main.exe) A closed source VB COM object implemented as a dll (comobj.dll) Code that I am developing in Python comobj.dll hosts a COM object (lets say,…
EB.
  • 3,383
  • 5
  • 31
  • 43
13
votes
1 answer

What exactly does win32com.client.Dispatch("WScript.Shell")?

I was searching for a Python piece of code which would simulate keystrokes. I stumble upon something using win32com.client.Dispatch("WScript.Shell"). I am not fan (at all) of Windows but it is to help a friend with automation of a game. I got a…
petosorus
  • 133
  • 1
  • 1
  • 6
12
votes
3 answers

How to save attachment from outlook using win32com.client in Python?

Im trying to read email and download the attachment to my own folder using win32com module in Python, I stopped at getting the attachment object: from win32com.client import Dispatch import datetime as date outlook =…
lsheng
  • 3,539
  • 10
  • 33
  • 43
12
votes
1 answer

Python: Refresh PivotTables in worksheet

I'm building a python script that will allow me to open a Excel 2010 worksheet and print it out. I got most of the way import win32com.client office = win32com.client.Dispatch("Excel.Application") wb =…
Norfeldt
  • 8,272
  • 23
  • 96
  • 152
12
votes
1 answer

Python read my outlook email mailbox and parse messages

Possible Duplicate: Reading e-mails from Outlook with Python through MAPI I am completely new to Python and have been given the task to write a program that connects to my Microsoft Outlook mailbox, goes through all the emails and if the subject…
user1650464
  • 121
  • 1
  • 1
  • 4
11
votes
2 answers

"Not implemented" Exception when using pywin32 to control Adobe Acrobat

I have written a script in python using pywin32 to save pdf files to text that up until recently was working fine. I use similar methods in Excel. The code is below: def __pdf2Txt(self, pdf, fileformat="com.adobe.acrobat.accesstext"): …
Blish
  • 113
  • 1
  • 5
11
votes
3 answers

Charts from Excel to PowerPoint with Python

I have an excel workbook that is created using an excellent "xlsxwriter" module. In this workbook, there about about 200 embedded charts. I am now trying to export all those charts into several power point presentations. Ideally, I want to preserve…
nyan314sn
  • 1,766
  • 3
  • 17
  • 29
11
votes
3 answers

Extract sender's email address from Outlook Exchange in Python using win32

I am trying to extract the sender's email address from outlook 2013 using win32 package in python. There are two kinds of email address type in my Inbox, exchange and smtp. If I try to print the the sender's email address of Exchange type, I am…
python
  • 4,403
  • 13
  • 56
  • 103
11
votes
1 answer

win32com.client.Dispatch + Cherrypy = CoInitialize has not been called

The following code works well, but it fails if executed from a CherryPy app method with the error message CoInitialize has not been called: import win32com.client xl = win32com.client.Dispatch("Excel.Application") xl.quit() This post suggests a…
stenci
  • 8,290
  • 14
  • 64
  • 104
11
votes
2 answers

'proper' & reliable way to get all installed windows programs in Python?

I've seen numerous ways of retrieving installed programs on WinXP+ in python. What is the proper and most robust way of doing this? Currently I'm accessing HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall and reading each of the keys…
ThantiK
  • 1,582
  • 4
  • 17
  • 31
11
votes
1 answer

iTunes 11 scripting on Windows

Does anyone know of a way to programmatically inspect podcasts and create playlists via Python for iTunes 11 on Windows? Prior to iTunes 11, one could script it on Windows from Python using the win32com.client package. While technically this is…
Mr Fooz
  • 109,094
  • 6
  • 73
  • 101
10
votes
4 answers

Error "The object invoked has disconnected from its clients" - automate IE 8 with python and win32com

I would like to automate Internet Explorer 8 (using python 2.7 on Windows 7) machine. Here is my code after a post found on SO: import sys, time from win32com.client import WithEvents, Dispatch import pythoncom import threading …
Skarab
  • 6,981
  • 13
  • 48
  • 86
10
votes
1 answer

How to access the outlook folders other than default ones (like Inbox, Sent) using python win32com?

This is how I am able to access the inbox: outlook = Dispatch("Outlook.Application").GetNamespace("MAPI") inbox = outlook.GetDefaultFolder("6") When I tried to access the user created folders in Outlook using the below code: outlook =…
soldy
  • 103
  • 1
  • 1
  • 5