win32com

How can I use Microsoft Word's spelling/grammar checker programmatically?

I want to process a medium to large number of text snippets using a spelling/grammar checker to get a rough approximation and ranking of their "quality." Speed is not really of concern either, so I think the easiest way is to write a script that passes off the snippets to Microsoft Word (2007) and runs its spelling and grammar checker o...

Updating MS Word (or Open Office) bookmarks with Python

I'd like to fill MSWord bookmarks from a python script. I can't find such functions in win32com(MSWord) or in PyUno(OpenOffice). Does anyone know how to use bookmarks from Python? ...

How to close not responsive Win32 Internet Explorer COM interface?

Hello, actually this is not hang status, i mean..it slow response, so in that case, i would like to close IE and want to restart from start. so closing is no problem ,problem is ,how to set timeout ,for example if i set 15sec, if not webpage open less than 15 sec i want to close it and restart from start. is this possible to use with I...

win32com IE interface PAMIE javascript click

Hello, these day im making some script. i have encounter some problem with my script work. problem is i want to click emulate javascript on following site. http://news.naver.com/main/presscenter/category.nhn this site is news site. and everyday news content also changed, but javascript is not changed. for example i want to click ja...

How to use python win32com to save as excel file

I have a small python code to open an Excel file. Now I want to "Save As" with a different name but same format. How do I do that.. Any help will be great. FK ...

Python: error while checking IE state

Please, help me with Python 2.6 and win32com. I'm a newbie to Python and I got error when I start the next program: import pywintypes from win32com.client import Dispatch from time import sleep ie = Dispatch("InternetExplorer.Application") ie.visible=1 url='hotfile.com' ie.navigate(url) while ie.ReadyState !=4: sleep(1) print 'O...

How to mimic vb's control array in python for win32com ?

I need to dynamically create com objects from an activex dll and each of the objects can raise events which should be handled with event handlers. I can do this easily with win32com.client.Dispatch and win32com.client.WithEvents and associate a "separate" class of event handlers with each of the objects. Like so: class evt_1: def O...

Asynchronous data through Bloomberg's new data API (COM v3) with Python?

Hi there, Does anyone know how to get asynchronous data through Bloomberg's new data API (COM v3) with Python? I found this code below on wilmott.com and it works just fine, but it's for the old API version. Does anyone know the corresponding code for the new version? from win32com.client import DispatchWithEvents from pythoncom impor...

Using win32com and/or active_directory, how can I access an email folder by name?

In python w/ Outlook 2007, using win32com and/or active_directory, how can I get a reference to a sub-folder so that I may move a MailItem to this sub-folder? I have an inbox structure like: Inbox | +-- test | `-- todo I can access the inbox folder like: import win32com.client import active_directory ses...

Using win32com and/or active_directory, how can I change the conversation of a MailItem?

In Python w/ Outlook 2007, using win32com and/or Active Directory, how can I change the conversation of an email? Is there a way to change the mapping of a ConversationIndex to a ConversationTopic? I can successfully change the subject of a MailItem by creating a new MailItem, but when I view the folder in "Conversation" view mode, the...

'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 from there to get a list. (I've been told this isn't the proper way of doing things) I've...

py2exe and win32com

Can py2exe create standalone executables even ones requiring the win32com package? I've googled / searched SO to no avail. ...

RegFree DLL with CPython using win32com module

Hi, I am currently using the win32com module of CPython to use a DLL. I know some people using IronPython to automagically get the list of functions provided by this DLL. They don't need to register the DLL. I'd like to do the same as them but with CPython. 1) Is it possible to use CPython and win32com to connect to a dll reg-free. Ho...

Python win32com: Excel set chart type to Line

This VBA macro works: Sub Draw_Graph() Columns("A:B").Select ActiveSheet.Shapes.AddChart.Select ActiveChart.SetSourceData Source:=ActiveSheet.Range("$A:$B") ActiveChart.ChartType = xlLine End Sub This Python (near) Equivalent almost works: from win32com import client excel=client.Dispatch("Excel.Application") excel.V...

How to force Excel VBA to use updated COM server

I'm developing a COM server to be used from Excel VBA. When I update the server (edit code, unregister, re-register) Excel seems to carry on using the original version of the COM server, not the updated version. The only way I have found to get it to use the updated version is to close and re-open Excel, which gets a bit irritating. I...

py2exe/pyinstaller and DispatchWithEvents

I have a program that uses the win32com library to control iTunes, but have been having some issues getting it to compile into an executable. The problem seems to revolve around using DispatchWithEvents instead of Dispatch. I've created a very simple program to illustrate my problem: import win32com.client win32com.client.gencache.is_re...

How do I search & replace all occurrences of a string in a ms word doc with python?

Hello there, I am pretty stumped at the moment. Based on http://stackoverflow.com/questions/1045628/can-i-use-win32-com-to-replace-text-inside-a-word-document I was able to code a simple template system that generates word docs out of a template word doc (in Python). My problem is that text in "Text Fields" is not find that way. Even i...

How to open write reserved excel file in python with win32com?

Hello, I'm trying to open a write-protected ms excel 2007 file using win32com in python -- I know the password. I can open it with user input of the password into the excel dialog box. I want to be able to open the file without any user interaction. I've tried the following, but it still pops up the dialog box. app.Workbooks.Open("f...

win32com equivalent of xlrd's sheet.ncols

xlrd makes it pretty easy to know what the last column is. is there an easy way using win32com? I have tried using ws.UsedRange.Rows.Count but this doesnt seem to give a correct answer. ...

Why is win32com so much slower than xlrd?

I have the same code, written using win32com and xlrd. xlrd preforms the algorithm in less than a second, while win32com takes minutes. Here is the win32com: def makeDict(ws): """makes dict with key as header name, value as tuple of column begin and column end (inclusive)""" wsHeaders = {} # key is header name, value is column begi...