pywin32

Python bindings for Microsoft UI Automation? [closed]

我与影子孤独终老i 提交于 2019-12-05 08:45:16
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Anybody know of any Python bindings for Microsoft UI Automation? http://msdn.microsoft.com/en-us/library/ms747327.aspx without having to use IronPython. I am aware of the excellent pywin32 work, but Microsoft UI Automation is supposed to be the successor of the Active Accessibility layer, which I have been using on Windows XP. I need to migrate of the "Active Accessibility" functionality (event triggers on open

how to open a program in python and send keystrokes?

雨燕双飞 提交于 2019-12-05 07:48:20
问题 I want to open a browser, click on some fields and then send keystrokes. The following code clicks at any point on screen. win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0) Now i want to send keystrokes to that active application. How can i do that? 回答1: I think that library from Google code will do the job: http://code.google.com/p/sendkeys-ctypes/ Check that link also for a sample code: http:/

is there a good example of using pywin32 createprocessasuser and getting the output?

天涯浪子 提交于 2019-12-05 07:28:29
问题 I need to use the pywin32 method of creating a process as a different user and then get the stdout, the stderr and the error code from the spawned process as well as feed input into the process while it is running. The problem is, I can't seem to find a very good example of this for the createprocess function. This problem is further complicated by the fact that I need to run the subprocess as a different user and then get the stderr, stdout, feed in the stdin and retrieve the errorcode when

Problem installing pywin32

故事扮演 提交于 2019-12-05 06:53:25
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ? From the pywin32 README If the installation process informs you that Python is not found in the registry, it almost certainly means you have downloaded the wrong version - either for the wrong version of Python, or the wrong "bittedness". Are you sure you got the right version for your python and your cpu

Pywin32 save .docx as pdf

一曲冷凌霜 提交于 2019-12-05 02:16:34
I'm using Word 2013 to automatically create a report as a docx and then save it as a pdf format. But when I call the function SaveAs2(), the script pop out the "save as" windows and throws this exception : (-2147352567, 'Exception occurred.', (0, u'Microsoft Word', u'Command failed', u'wdmain11.chm', 36966, -2146824090), None) Here is my code to open and to save as a new file: self.path = os.path.abspath(path) self.wordApp = win32.Dispatch('Word.Application') #create a word application object self.wordApp.Visible = False # if false hide the word application (app does't open but still usable)

py2exe com dll problem

依然范特西╮ 提交于 2019-12-05 02:07:00
问题 i'm trying making a com dll in python. but i try register to compiled dll have a error message "run time error r6034" and "could not load python dll" what is the solution this problem ? mycode : setup.py: # This is the distutils script for creating a Python-based com dll # server using ctypes.com. This script should be run like this: # # % python setup.py py2exe # # After you run this (from this directory) you will find two directories here: # "build" and "dist". The .dll file in dist is what

Send key combination with python

末鹿安然 提交于 2019-12-05 01:44:05
问题 I want to be able to send the key combination SHIFT + CTRL + . (dot) using the following code: import win32com.client as comclt wsh= comclt.Dispatch("WScript.Shell") wsh.SendKeys() So far I was able to send CTRL + . (dot) like this : wsh.SendKeys(^.) How do I add the SHIFT key there ? Thanks to anyone who answers :) 回答1: For Shift use + Complete list is available here: SendKeys ... To specify that a combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed,

How can I set up a dedicated screen area for an application in Python?

社会主义新天地 提交于 2019-12-05 01:42:58
问题 A good example is MS OneNote. It has the option to be fixed to one side of the screen and pushes all other windows to the side. When maximizing or resizing other windows, they can only expand up to the edge of OneNote. Does Python have this capability using Tkinter or another module? Thank you for any assistance. 回答1: The win32 feature you're looking for is called Application Desktop Toolbars - it allows your application to cooperate with the shell and reserve space along the side, similar to

How to have a feed of windows log event under windows?

寵の児 提交于 2019-12-04 22:52:39
The problem was the following: have a feed of the event log under windows. I was asked on irc to help to solve it. I give as an answer the solution we reached. I was inspired by this question python listen the windows log event Solution #!/usr/bin/env python3 # -*- coding: utf-8 -*- import win32evtlog # requires pywin32 pre-installed import win32event server = 'localhost' # name of the target computer to get event logs logtype = 'System' # 'Application' # 'Security' filehandler = win32evtlog.OpenEventLog(server,logtype) eventhandler = win32event.CreateEvent(None, 1, 0, "wait") flags =

Error “ValueError: can't format dates this early” on one PC, works on other

为君一笑 提交于 2019-12-04 22:13:39
I have a Python script that works perfectly fine on my development PC. Both are Windows 7 with the same Python version (2.7.9). However on the target machine I get a ValueError: can't format dates this early The error seems to come from pywin32 module. The code uses a third-party library invoked by pywin32: raw = win32com.client.Dispatch("MyLib.MyClass") and then fails later on: acq_time = raw.GetCreationDate() Now I'm lost why this is working on my PC and not on the target machine. Both have a "corporate install" of Windows 7, for example, the same Regional and date-time settings. What is the