pywin32

Using win32service module with IronPython

Hey,so I'm trying to take an existing IronPython script I have and convert it into a windows service that runs on one of our servers at all times. Unfortunately I can't seem to get the modules I need. I downloaded the pywin32 extensions (http://sourceforge.net/projects/pywin32/) but I can't install them because I only have IronPython ins...

GetWindowRect too small on Windows 7

The actual problem I'm trying to solve is, I want to automatically find out the size of the margins around windows. If you can find a better way, please by all means answer that instead of this. To do this I decided to take a screenshot of a test window and measure the margins. This is simple enough, as I expect no margins will ever be ...

How can I map non-English Windows timezone names to Olsen names in Python?

If I call win32timezone.TimeZoneInfo.local().timeZoneName, it gives me the time zone name in the current locale (for example, on a Japanese machine, it returns u"東京 (標準時)"). I would like to map this name to an Olsen database timezone name for use with pytz. CLDR windowZones.xml helps me to map English names, but can't handle the Japanes...

Python: get currently logged user and his/her special folders

Does this code win32api.GetUserName() works fine on all win system from win 2000 to win 7 ? What about if user is not local user but domain user, does it still work ? When i use this function shell.SHGetFolderPath(0, shellcon.CSIDL_someDirectory, 0, 0), do I get wanted folder for currently logged user ? Any help appreciated. ...

teamplayer and pyhook interacting strangely

I'm using teamplayer, which lets you connect more mice to your computer to be used simultaneously. I'm also using pyHook to capture mouse events, with the following code: import pyHook import pythoncom def onclick(event): # called when mouse events are received print 'MessageName:',event.MessageName print 'Message:',event.Message...

converting structures in c to pywin32?

i am trying to use TTM_GETTEXT via SendMessage using pywin32. the problem is, the structure of the lparam, which is where the text should be stored, has to be TOOLINFO, which is well documented in MSDN, but has no counterpart in pywin32. is there a way to create the same structure using python and pywin32? Edit: here's the code i came u...

py2exe + pywin32 MemoryLoadLibrary import fail when bundle_files=1

I have created a simple program which uses pywin32. I want to deploy it as an executable, so I py2exe'd it. I also didn't want a huge amount of files, so I set bundle_files to 1 (meaning bundle everything together). However, when I attempt running it, I get: Traceback (most recent call last): File "pshelper.py", line 4, in <module> ...

Using Python to send/receive text from GUI program

Hi all - I'm using PyWin32's win32process.CreateProcess to start up a GUI program that has functionality I want to use in a Python class. I want to do the following from Python with this GUI: sent text to individual windows within the GUI (which seem to change identifiers every time I create the process if WinSpy++ is to be believed)...

python + windows: run exe as if it's unrelated to the current process

I know I can use subprocess.Popen to run an executable, and potentially redirect stdin and stdout to files / using pipes to my process. Is there a way to run an executable such that the spawned process has no relation to the current Python process, however? Meaning, I want to start a process in the same way as if I would double-click on ...

Modifying Exchange ACL for folders with python

Hi folks, while try to read the ACL Table of a folder, I ran into this problem: In a C++ tool (MFCMAPI) this method is used to get the Property PR_ACL_TABLE in a usable data type: // Open the table in an IExchangeModifyTable interface EC_H(lpMAPIProp->OpenProperty( ulPropTag, (LPGUID)&IID_IExchangeModifyTable, 0, MAPI_DEFERRE...

PythonWin saving session state

I would like to be able to save my session state within the PythonWin editor (e.g. these three files are opened and positioned in these particular locations within the PythonWin window). I can get handles to each of the child windows within PythonWin using win32gui, as well as the titles of each of the files and the positions/sizes of t...

How to control the size of the Windows shell window from within a python script?

When launching a script-type python file from Windows you get a windows shell type window where the script runs. How can the script determine and also set/control the Window Size, Screen Buffer Size and Window Position of said window?. I suspect this can be done with the pywin32 module but I can't find how. ...

Problem getting System.ContentStatus using DSOFile.OleDocumentPropertiesClass

I've been able to read many of the Windows System Properties through Pywin32 and DSOFile, but I'm having trouble accessing the System.ContentStatus property. import win32com.client DSO = win32com.client.Dispatch("DSOFile.OleDocumentProperties") DSO.Open('C:\test.doc') print DSO.SummaryProperties.Company #works print DSO.SummaryProperti...

Get Active Directory group members using PyWin32

Hello, I need to list all Active Directory group's members - can I do this without using LDAP queries with PyWin's win32security, for instance? I can lookup accounts' sids and names using it (LookupAccountSid and LookupAccountName), but how about getting all group members? For now I cannot figure out what functions I should use. I ...

Retrieve User Entry IDs from MAPI

Hi folks, I extended the win32comext MAPI with the Interface IExchangeModifyTable to edit ACLs via the MAPI. I can modify existing ACL entries, but I stuck in adding new entries. I need the users entry ID to add it, according this C example (Example Source from MSDN) STDMETHODIMP AddUserPermission( LPSTR szUserAlias, LPMAPISES...

python+win32: detect window drag

Is there a way to detect when a window that doesn't belong to my application is being dragged in windows using python/pywin32? I want to set it up so that when I drag a window whose title matches a pattern near the desktop edge, it snaps to the edge when the mouse is let go. I could write code to snap all windows with that title to the d...

pywin32 captive installation (avoid py*.dll getting installed in system32 directory)

I have python as an embedded scripting environment in my application. I supply the python bits (python26.dll, DLLs & Lib folders) with my application. All this to avoid asking users to install python (you know how it goes in big corporations). All works nice except pywin32. It installs pythoncom26.dll and pywintypes26.dll to the system3...

Where is the documentation for Mark Hammond's pywin32 package?

Where is the documentation for Mark Hammond's pywin32 package? Yes, the title says it all. I haven't found any documentation links in his home page or Sourceforge page. ...

Running Python Scripts From MS Office

I have installed PythonWin installed.. I can read and write to Excel from Python, not a problem. Not the usage I need. All examples I have found are more complex than I need. Since, I'm moving away from Excel, I need a half steps for testing. Whats the simplest way to fire off python scripts from Excel. I dont need gui. Usage: On ope...

copying and pasting from/to clipboard with python/win32

I downloaded the win32 for python 2.6 from this site. This is the code to get/set the clipboard. def test(): OpenClipboard() d=GetClipboardData(win32con.CF_TEXT) # get clipboard data SetClipboardData(win32con.CF_TEXT, "Hello") # set clipboard data CloseClipboard() if __name__ == '__main__': if sys.platform == 'wi...