Re: [python-win32] filling in field in a Word doc?

2011-07-13 Thread sharpblade
I have been doing a lot of work with Word and pywin32, it is a nightmare (Especially with formatting). If you want to populate pre-defined fields then the easiest way I have found is to create a template document and fill it with bookmarks, then pretty much do this: document.Bookmarks("my_bookmark

Re: [python-win32] Converting HTML formatting to Microsoft Word

2011-06-15 Thread sharpblade
that the WYSIWYG editor also outputs to format text as well as and , so i'm hacking away at it to get it to work with those. On Wed, Jun 15, 2011 at 11:51 AM, Mark Hammond wrote: > On 14/06/2011 6:51 PM, sharpblade wrote: >> >> I whipped up this function: http://pastebi

Re: [python-win32] Converting HTML formatting to Microsoft Word

2011-06-14 Thread sharpblade
Ah yes, sorry I didn't specify that. It is part of an existing doc: I have a Django web application with a Report model which contains information I need to put into a word document. Most of this is simple stuff requiring no formatting, and I achieve this by defining several bookmarks within the ma

Re: [python-win32] 'exit is not defined'

2011-06-03 Thread sharpblade
Why do you need a finally block there at all? Just terminate on the exception, there is no point in setting it to None then checking if its none. ~Tom On Fri, Jun 3, 2011 at 9:33 AM, Jacob Kruger wrote: > Sorry, but replying on list now as well. > > Either way, seems that while did have the impo

Re: [python-win32] How do I get the URL of the active tab in Internet Explorer

2010-11-30 Thread sharpblade
This might be of some help: http://social.msdn.microsoft.com/forums/en-US/ieextensiondevelopment/thread/e3a501d6-2163-4cc0-be2d-5011e7fa9613/ Check out Dan Morris's post, or T E dixons

Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread sharpblade
You are not using the WMI efficiently. You iterate over every process to test if only one is there, when you can use WMI like so: >>> import wmi >>> x = wmi.WMI() >>> x.query("SELECT * FROM Win32_Process WHERE Name = 'xchat.exe'") [<_wmi_object: \\TOM-PC\root\cimv2:Win32_Process.Handle="7052">] >>

Re: [python-win32] SHEmptyRecycleBin error on Vista/7

2009-11-22 Thread sharpblade
I think this error appears when you empty a recycle bin that is empty. I tried that code snippet and it gave me the same error, but when I actually put something in the recycle bin and then ran it again it went through fine without raising an exception. Tom On Sun, Nov 22, 2009 at 1:07 AM, Andrew