pywin32

How to extract a particular attribute from instance of Win32_PnPEntity?

拥有回忆 提交于 2019-12-24 12:34:39
问题 def getPnpDeviceInfo(): c = wmi.WMI() wql = "SELECT * FROM Win32_PnPEntity WHERE Manufacturer != 'Microsoft' AND NOT PNPDeviceID LIKE 'ROOT\\%'" print ("All physical PNP devices") for J in c.query(wql): print(J) This function (the query) typically returns all physical PNP devices, here is an output sample : instance of Win32_PnPEntity { Caption = "ACPI Lid"; ClassGuid = "{4d36e97d-e325-11ce-bfc1-08002be10318}"; ConfigManagerErrorCode = 0; ConfigManagerUserConfig = FALSE; CreationClassName =

pywin32-220 installer “high risk” file

时光怂恿深爱的人放手 提交于 2019-12-24 11:55:22
问题 When I try to install pywin32-220 it will be stopped by Norton saying that it's threat name "SONAR.Heuristic.132" and a "High risk file". It removes the pywin32-220 installer... So how can I get pywin32? Pywin32 download - http://sourceforge.net/projects/pywin32/files/?source=navbar SONAR.Heuristic.132 threat: (Norton link to details) http://www.symantec.com/security_response/writeup.jsp?docid=2015-061517-5721-99&vid=4294925827&product=Norton%20Internet%20Security&version=22.5.5.15&plang=sym

Why genguid.exe generated clsid won't work?

*爱你&永不变心* 提交于 2019-12-24 11:18:17
问题 I am trying to modify exceladdin.py example from pywin demos. Otherwise I can modify it, but when I replace the clsid given in example: "{C5482ECA-F559-45A0-B078-B2036E6F011A}" With the one generated by genguid.exe or pythoncom.CreateGuid() e.g.: "{E44EF798-7FDF-4015-AED6-00234CBBBA77}" The com-addin stops working. No trace, no errors just the following text in excel com-objects list (translation) "Add-in not loaded. Error in runtime while loading com object." Am I missing a step in

How to emulate press and hold with pywin32

别说谁变了你拦得住时间么 提交于 2019-12-24 09:26:52
问题 I am trying to write a python script to send a press and hold key signal. Right now all I have managed to do is the following: import win32com.client shell = win32com.client.Dispatch("Wscript.Shell") shell.SendKeys("z") However, this only sends an instantaneous key pressed event. What I would like to do is a key down and key up, something along the lines of: shell.SendKeys("z{down}") time.sleep(.25) shell.SendKeys("z{up}") But I cannot find any documented way to achieve this. EDIT: I also

Installing pywin32 for python 3.5 in windows 7

倾然丶 夕夏残阳落幕 提交于 2019-12-24 08:49:51
问题 I have experiencing a problem when installing pywin32 for python 3.5 to my windows 7 PC. The problem is, installation wizard stating that I have no any python versioned as 3.5 in my registery. My pywin32 file is downloaded from here => pywin32-220.win-amd64-py3.5.exe. The thing is, when I run python -V code line, I am able to see that I've python 3.5.2 on my PC. So I don't understand that is the real problem is. Did I get something wrong in logical way? Any help will be greatly appreciated.

How to create Python ctypes structures for MS Windows PACKAGE_ID and PACKAGE_INFO structures?

孤人 提交于 2019-12-24 06:37:20
问题 I'm trying to translate this SO answer code into Python (and a bit from the other answer there) with the help of official documentation for PACKAGE_ID and PACKAGE_INFO. I'm getting full package names by GetPackageFullName , but some of my structures aren't formed well as OpenPackageInfoByFullName gives Unicode characters that are jibberish to me. Also PackageIdFromFullName returns ERROR_INSUFFICIENT_BUFFER when called. EDIT : As Paul Cornelius noticed, my code had issues with PACKAGE_INFO

Sorting with xlwings (pywin32)

青春壹個敷衍的年華 提交于 2019-12-24 06:32:28
问题 I need to use python to sort an excel spreadsheet by a given row. For the testing, I'm using this data (in a file named xlwings sorting.xlsx): Numbers Letters Letters_2 7 A L 6 B K 5 C M 4 D J 3 E N 2 F I 1 G H Which should be sorted into this: Numbers Letters Letters_2 1 G H 2 F I 3 E N 4 D J 5 C M 6 B K 7 A L One would think this to be a trivial task, but there seems to be nothing in the way of any documentation (if there is something, it's buried so deep that two days of reading hasn't

Sorting with xlwings (pywin32)

Deadly 提交于 2019-12-24 06:32:24
问题 I need to use python to sort an excel spreadsheet by a given row. For the testing, I'm using this data (in a file named xlwings sorting.xlsx): Numbers Letters Letters_2 7 A L 6 B K 5 C M 4 D J 3 E N 2 F I 1 G H Which should be sorted into this: Numbers Letters Letters_2 1 G H 2 F I 3 E N 4 D J 5 C M 6 B K 7 A L One would think this to be a trivial task, but there seems to be nothing in the way of any documentation (if there is something, it's buried so deep that two days of reading hasn't

How to pass arguments to win32com event handler

自闭症网瘾萝莉.ら 提交于 2019-12-24 03:41:34
问题 The code below works fine. I can't find a way to pass some arguments to EventHandler or to call methods of MainClass from EventHandler . For example instead of using constant param , I'd like to pass it through constructor or setter method. I've tried recommendations from here. But in this case EventHandler instance does not catch any events (or at least nothing appears in stdout). class EventHandler: param = "value" def OnConnected(self): print 'connected' return True class MainClass: def

How do you move a user to a different OU using Python

早过忘川 提交于 2019-12-23 13:01:10
问题 I've been having a play with the fantastic active_directory module from Tim Golden and the extensive python-ldap module and while I see a great slew of articles on how to query, modify, create and delete entries within Active Directory from python I can't for the life of me find any advise on moving a user to a different OU using python. Is my google-foo failing me or is this not possible? (I've had great success with c# but I prefer to work in python where I can) Thanks in advance EDIT: OK,