pywin32

How does files get copy/cut/paste using clipboard operations (ctrl-c /ctrl-v)

天大地大妈咪最大 提交于 2019-12-08 01:24:37
问题 Was trying to use win32clipboard to do the copy paste operations for text (till now), and was able to do it with ease.But now am wondering how does the copy/paste operations would be accomplished for folders/files etc through that. I am using python to achieve the same. Could not also find any relevant formats for that. Is it something like file path gets copied and then paste operation identifies clipboard data as file path and then actually does the file copy? No clue :(. 回答1: Windows copy

which argtypes for NetShareAdd

最后都变了- 提交于 2019-12-07 19:27:25
The win32 function NetShareDel takes three arguments, LPCWSTR LPCWSTR and DWORD. So I use the following list for argtypes: C.windll.Netapi32.NetShareDel.argtypes = [LPCWSTR, LPCWSTR, c_int] C.windll.Netapi32.NetShareDel.restype = c_int C.windll.Netapi32.NetShareDel(server, shareName, 0) That works fine, but I can't figure out what to use for NetShareAdd, especialle the byte array for NET_SHARE_INFO struct and the last byref(c_int) argument. Here's the code: def Share(server, shareName, dir): info = SHARE_INFO_2() STYPE_DISKTREE = 0 info.shi2_netname = shareName info.shi2_path = dir info.shi2

PyWin32 get network information/statistics

家住魔仙堡 提交于 2019-12-07 08:48:27
I am trying to get Network Statistics for my Windows 7 system using PyWin32 . The steps I followed: 1) Run COM MakePy utility and than select network list manager 1.0 type library under type library. 2) Above process generated this python file . Now the problem I am facing is after the above two steps what should be my next step . I tried a couple of things like: I copied the CLSID = IID('{DCB00000-570F-4A9B-8D69-199FDBA5723B}') line from the above generated python file and used it like >>> import win32com >>> obj = win32com.client.gencache.GetClassForCLSID("{DCB00000-570F-4A9B-8D69

pywintypes27.dll not found using Apache, Django, pywin32, Python2.7 and mod_wsgi

Deadly 提交于 2019-12-07 08:44:11
问题 I have a Django application using django-mssql to communicate w/ SQL Server. This works just fine in the dev server (runserver) but under Apache/mod-wsgi, I get a error related to it trying to find a .dll which does exist: Exception Type: ImportError Exception Value: No system module 'pywintypes' (pywintypes27.dll) Exception Location: C:\Python27\lib\site-packages\win32\lib\pywintypes.py in __import_pywin32_system_module__, line 98 Python Executable: C:\Program Files (x86)\Apache Software

python: convert pywintyptes.datetime to datetime.datetime

好久不见. 提交于 2019-12-07 07:32:16
问题 I am using pywin32 to read/write to an Excel file. I have some dates in Excel, stored in format yyyy-mm-dd hh:mm:ss. I would like to import those into Python as datetime.datetime objects. Here is the line of code I started with: prior_datetime = datetime.strptime(excel_ws.Cells(2, 4).Value, '%Y-%m-%d %H:%M:%S') That didn't work. I got the error: strptime() argument 1 must be str, not pywintypes.datetime I tried casting it to a string, like so: prior_datetime = datetime.strptime(str(excel_ws

Python bindings for Microsoft UI Automation? [closed]

拟墨画扇 提交于 2019-12-07 05:15:43
问题 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

press enter via python script

陌路散爱 提交于 2019-12-06 23:13:36
We are trying to create a python script to install an app via windows shell prompt, executing our python script. We have an output prompt from the app.exe indicating "Press Enter to Continue..." We tried to simulate the Enter key but it doesn't work. The prompt just sits still not moving to the next wizard step. How do we overcome this problem? import subprocess import win32console APP_BIN = 'app.exe' def main(): proc = subprocess.Popen([APP_BIN,'-i','console'],stdin=subprocess.PIPE, stdout=subprocess.PIPE) proc.stdin.write("\r\n") <--- issue output = proc.stdout.readline() <--- issue print

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

拥有回忆 提交于 2019-12-06 16:58:36
问题 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 回答1: 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 =

Python 'No module named win32gui' after installing pywin32

笑着哭i 提交于 2019-12-06 15:38:52
Running python 3.6 on windows 8. ModuleNotFoundError: No module named 'win32gui' I have tried multiple installations of pywin32 but none have worked so far. https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/ goes through installation without problems but the issue persuades. Same with pip installing: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32 In my Python root there is now multiple pywin32/win32 variants in the site-packages folder. pywin32.pth doesn't contain a win32gui but only the following: # .pth file for the PyWin32 extensions win32 win32\lib Pythonwin I could as

Having several issues with a Python service for Windows

微笑、不失礼 提交于 2019-12-06 15:17:52
I've checked at least a couple of dozen of similar cases to mine and still haven't come up with a solution, I hope someone can shed some light, there's gotta be something I'm missing here. I'm using Python3.6 to make a Windows service, the service has to run a .exe file if it's not running. Here's the .py: import win32service import win32serviceutil import win32api import win32con import win32event import win32evtlogutil import psutil import subprocess import os, sys, string, time import servicemanager class SLAAgent (win32serviceutil.ServiceFramework): _svc_name_ = "SLAAgent" _svc_display