pywin32

How to extract 32x32 icon bitmap data from EXE and convert it into a PIL Image object?

守給你的承諾、 提交于 2019-12-11 05:26:06
问题 I'm trying to extract a 32x32 icon from an EXE, and convert the bitmap data into an PIL Image object. My final goal is to compare the icon to another 32x32 PNG and get the difference with RMS. I've tried doing win32gui.ExtractIconEx() then win32gui.GetIconInfo() and attemping to Image.open() on that, but PIL doesn't accept PyHANDLE objects, apparently. I've also attemped to open the exe directly with Image.open() , obviously that doesn't work. I'm stumped right now, is there any way this is

Sending an email through Python

和自甴很熟 提交于 2019-12-11 04:08:46
问题 I am trying to send an email through Python. I can get the email to display, but when I switch to send I get an error. This happens when I run this on a virtual machine. When I run on my laptop it works fine. My Code: #send email import win32com.client olMailItem = 0x0 obj = win32com.client.Dispatch("Outlook.Application") newMail = obj.CreateItem(olMailItem) newMail.Subject = "mysubject" newMail.HTMLBody = "mybody" newMail.To = "myemail@gmail.com" newMail.Send() My error: newMail.Send() File

Memory leak using pywin32com for opc

淺唱寂寞╮ 提交于 2019-12-11 03:56:48
问题 I am having a hard time trying to figure out how to address leaking memory. I think this might be an issue with pywin32 but I am not completely sure. My code to do reading/writing individual items seems to work just fine, but when using group functions it slowly leaks memory. I suspect this is from the 1-based array that must be passed in the server_handles. Does anyone know of a work around? def read_group(self, group, mode=OPC_SYNC, source=OPC_DS_CACHE): """ Read a group returning a list of

Call a macro with parameters : Python win32com API

亡梦爱人 提交于 2019-12-11 02:57:20
问题 What I want to do is call a macro from my python code. Here isa sample of the sources : xl = win32.gencache.EnsureDispatch('Excel.Application') xl.Visible = 1 xl.Workbooks.Open("C:\\Program Files\\Microsoft Office\\Office14\\XLSTART\\perso.xlsm") xl.Workbooks.Open(argv[1]) xl.Application.Run('perso.xlsm!' + argv[2]) xl.Application.Run('perso.xlsm!' + argv[2] + '2') xl.Workbooks.Open(argv[0]) xl.Application.Run('perso.xlsm!aggregate_report_ouverture_appli') xl.Application.Run('perso.xlsm!macro

Cannot open Visio document with Python

女生的网名这么多〃 提交于 2019-12-11 02:34:39
问题 I am attempting to do some automation in Visio using Python. I am able to open the Visio application and create a new document, but cannot open an existing document. Here is the code that I am trying. import win32com.client visio = win32com.client.Dispatch("Visio.Application") # this works doc = visio.Documents.Open("C:\Users\username\test.vsd") # nope The error I get back is Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<COMObject <unknown>>", line 3, in OpenEx

Calling FSCTL_CREATE_OR_GET_OBJECT_ID from Python

别等时光非礼了梦想. 提交于 2019-12-11 00:46:22
问题 I'm trying to get NTFS object IDs to use in a Python backup program. I'm in way over my head, but managed to create a function that returns... something. import sys import win32file import winioctlcon def object_id(filename): """ NTFS OBJECT_ID """ fhandle = win32file.CreateFileW( # FileName filename, # DesiredAccess win32file.GENERIC_READ, # ShareMode win32file.FILE_SHARE_READ | win32file.FILE_SHARE_WRITE, # SecurityAttributes None, # CreationDisposition win32file.OPEN_EXISTING, #

python win32api for Mac

前提是你 提交于 2019-12-11 00:43:05
问题 I have been trying to perform some advanced word document manipulation with python-docx , but I was advised to use Microsoft office API. The problem is that I can't install win32api from pywin32 home page because I get the following error: (IntellibookVenv) MacBook-Pro-de-Hugo:Intellibook hugovillalobos$ pip install pywin32 Collecting pywin32 Could not find a version that satisfies the requirement pywin32 (from versions: ) No matching distribution found for pywin32 I don't know wether I get

Spyder-IDE fails to start on Windows-10 with Python-3.8

…衆ロ難τιáo~ 提交于 2019-12-10 23:09:13
问题 checking out Python-3.8.0 (x64) on Windows-10, I got into trouble when trying to setup Spyder . Note: the issue was reproducible with a fresh Python installation on a clean Windows-10 system. However, no such issues on Linux (tested on debian/Mint). At first, everything went smooth during installation via pip install spyder . error #1: pywin32 After starting Spyder , it said in the IPython console window: Traceback (most recent call last): File "c:\users\USERNAME\appdata\local\programs\python

Is there a way to obfuscate/hide command line from windows task manager with winappdbg?

给你一囗甜甜゛ 提交于 2019-12-10 20:39:13
问题 i'm using python to call external programs in win7 x64, but i want to hide command line options. import winpexpect thread = winexpect.winspawn(cmd,timeout=TIMEOUT ) import pexpect thread = pexpect.spawn(cmd,timeout=TIMEOUT ) import subprocess ... since i'm passing the cmd tool with some secured info , and don't want others to see it in task manager ,is there a way to "obfuscate"/change it ? or even better, hide the process from task manager completely ? i read about this How to clear a

Creating a new Excel File in pywin32

可紊 提交于 2019-12-10 18:34:39
问题 I'm writing a program that, summarized, takes a notepad file and saves it as a excel file. Right now my program opens up a blank excel file I have created, just "Book1.xls": xlApp = Dispatch("Excel.Application") xlApp.Visible=0 xlWb = xlApp.Workbooks.Open(file_path+"/Book1.xls") workBook = xlApp.ActiveWorkbook sheet = xlApp.ActiveSheet and it uses Book1.xls to write into and format as is required, then saves it as another file name using workBook.SaveAs(new_file_path+'/UpdatedSheet.xls') I