[python-win32] How to insert macro into ms word by using python?

2012-07-18 Thread wanglei
Hello, I have some problem with pywin32com programming in ms word? I have a macro code, but my program language is python-extension, I want to insert the macro into ms word? And the word object is created by pywin32com, like docApp = win32com.client.Dispatch('Word.Application') doc = docApp.Doc

[python-win32] python-win32 with vba

2012-07-18 Thread 汪雷
Hi, I don't know how to handle ms word's events. By VBA, the code is as following: > Private Sub Ducoment_Open(): > my code > End Sub. The code in ms word macro is to capture the 'Open' event, when the word is opened, my code will be executed. How can I perform by python-win32. Thanks Reg

Re: [python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?

2012-07-18 Thread Tim Roberts
Jane Chen wrote: > Sorry. It's a mistake. However, I still get the same error message. > Maybe there is another mistake. :( > Is there any tool for debugging purpose? What I would do is write the code as a C program just to make sure the API does what I expect. That at least eliminates the Python

Re: [python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?

2012-07-18 Thread Jane Chen
Sorry. It's a mistake. However, I still get the same error message. Maybe there is another mistake. :( Is there any tool for debugging purpose?  Thank you, Jane >                    drive=".\\"+drive+'.' Why are you adding a dot?  That's a mistake.  You want  just ".\\E:" .  Remove the

Re: [python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?

2012-07-18 Thread Tim Roberts
Jane Chen wrote: > I want my script to tell if the removable disk is an SD card or not, > so I wrote the following script. > > buf_fmt='HH' > buf_size=struct.calcsize(buf_fmt) > > drives = (drive for drive in win32api.GetLogicalDriveStrings ().split > ("\\\000") if drive) > for drive

Re: [python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?

2012-07-18 Thread Jane Chen
I want my script to tell if the removable disk is an SD card or not, so I wrote the following script. buf_fmt='HH'   buf_size=struct.calcsize(buf_fmt) drives = (drive for drive in win32api.GetLogicalDriveStrings ().split ("\\\000") if drive)         for drive in drives:             if win32

Re: [python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?

2012-07-18 Thread Tim Roberts
Jane Chen wrote: > > Thank you for your help. > Could you please help me write better codes for GUID? What are you going to do with it? You will get back a 20-byte string. The last 16-bytes are the binary GUID. The way you handle that depends on what you need to do with it. > You are right.

Re: [python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?

2012-07-18 Thread Jane Chen
Jane Chen wrote: > > Thank you for your help. However, I still got pywintypes.error: (50, > "DeviceIoControl", "The request is not supported"). > >  I added the following codes to winioctlcon.py . You should not probably modify the standard library files, because you'll l