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
7
votes
2 answers

Python - Create Shortcut with arguments

Using win32com.client, I'm attempting to create a simple shortcut in a folder. The shortcut however I would like to have arguments, except I keep getting the following error. Traceback (most recent call last): File "D:/Projects/Ms/ms.py", line…
Dustin
  • 6,207
  • 19
  • 61
  • 93
6
votes
1 answer

How do I create an Outlook meeting request with an alternate sender/organizer?

I've developed a Python application to automate sending emails and meeting requests for internal office events. To keep these separate from my regular communications, we've set up an alternate email address that I can use to send the official…
Tim Whitcomb
  • 10,447
  • 3
  • 35
  • 47
6
votes
1 answer

how to get attributes from win32com.client.dispatch("Shell.Application")

I am trying to control my device manager programmatic through python (ie disable and re-enabling devices). However I am having trouble figuring out what are the attributes in the namespace of the "win32com.client.Dispatch("Shell.Application")". All…
Ken
  • 641
  • 3
  • 11
  • 25
6
votes
3 answers

Opening Outlook with Python

I am trying to open Outlook with Python and I got this... import win32com.client ol = win32com.client.Dispatch("outlook.Application") It opens Outlook but my probles is it opens it in the notification area of Windows (where the clock is) and it…
Trying_hard
  • 8,931
  • 29
  • 62
  • 85
6
votes
2 answers

Setting a property using win32com

I'm trying to create a bunch of Outlook rules automatically. I'm using Python 2.7, win32com, and Outlook 2007. To do this I must create a new Rule object and specify a folder for its move action. However, I can't set the Folder property successfully…
PAG
  • 1,836
  • 1
  • 18
  • 19
6
votes
1 answer

Install win32com on MacOs and Linux

My question is simple: can I install win32com python API (pywin32 notably) on an OS that is not Windows? I have been trying, on Mac, multiple versions of pip install pywin32, all have failed. An example below: If you managed to install it on Linux…
Mez13
  • 168
  • 1
  • 3
  • 13
6
votes
3 answers

Python - win32com visible false not working?

I am trying to convert an excel file to PDF. Using Print chosen worksheets in excel files to pdf in python and Python - Converting XLSX to PDF, I wrote the code below. This converts the excel to PDF without a problem but it opens the excel file. I…
phil_t
  • 851
  • 2
  • 7
  • 17
6
votes
1 answer

win32com get the list of available applications

there is a good construct, allows to control win32com objects, like win32com.client.Dispatch('Word.Application') win32com.client.Dispatch('Excel.Application') ... etc. Is there a way to get full list of available applications (*.Application) ? UPD.…
Vova
  • 563
  • 8
  • 20
6
votes
1 answer

Adobe Acrobat API in Python

System: Python 3.6 Windows 10 Goal: Use the Adobe Acrobat API to use the "Save As" feature to save a pdf to jpegs. Note: For my purposes I cannot use Wand or other packages. Resources: Adobe_API_Documentation Implementation_Example…
Schalton
  • 2,867
  • 2
  • 32
  • 44
6
votes
1 answer

Python win32com : Reading multiple Outlook inbox

I want to get the SenderEmailAddress of all email sent on two specified mail addresses : 123@abc.com and 456@def.com that are in my Outlook Application on my computer, the point is to make a list of all mail senders that will be kept in a csv…
David G
  • 63
  • 1
  • 3
6
votes
2 answers

Python DispatchWithEvents results in attribute error:

Using dispatch as win32com.client.Dispatch works fine, but produces attribute error: from DispatchWithEvents call win32com.client.WithEvents, problem exists until Temp\gen_py folder is removed I can remove the Temp\gen_py folder at the very…
Om Choudhary
  • 492
  • 1
  • 7
  • 27
6
votes
6 answers

Python Export Excel Sheet Range as Image

So it seems there's something weird going on with PIL ImageGrab.grabclipboard() import win32com.client from PIL import ImageGrab o = win32com.client.Dispatch('Excel.Application') o.visible = False wb = o.Workbooks.Open(path) ws =…
David Yang
  • 2,101
  • 13
  • 28
  • 46
6
votes
2 answers

EOFError in python win32com

I am running Sympathy for Data, a program based on python. It worked well until today. I got error message like this: File "..\Python27\lib\site-packages\win32com\client\__init__.py", line 11, in import gencache File…
NAX
  • 139
  • 1
  • 7
6
votes
1 answer

Create Windows Explorer shortcut with Run As Administrator

I'm using win32com.client to create a shortcut on Windows: from win32com.client import Dispatch shell = Dispatch("WScript.Shell") shortcut = shell.CreateShortCut(shortcut_path) # shortcut_path defined elsewhere shortcut.Targetpath =…
Periodic Maintenance
  • 1,698
  • 4
  • 20
  • 32
6
votes
2 answers

How to change Visio font name and color using Python?

I am using Python 2.7 with the win32com.client and trying to figure out how to change the font name and color for a Microsoft Visio 2013 shape. The code below creates a rectangle shape on a Visio document that is already open. This code is working…
John Bessire
  • 571
  • 5
  • 20