2,067 questions
1
vote
1
answer
101
views
how to use the win32gui.findwindows when the name of the titlebar your searching for is always changing
i am making a cookie clicker machine vision bot and i want it to display the specific window of cookie clicker
however the titlebar of the window is always changing depending on the current number of ...
0
votes
1
answer
46
views
Python, extract outlook meetings between two date with pywin32
I'm working on an application where I need to extract Outlook meetings using pywin32. To filter the specific meetings I require, I'm using the Restrict function with a date range filter.
However, the ...
1
vote
1
answer
93
views
Copy pasting Excel range to Outlook email - GetInspector Error
I don't recall making any changes to the code, but now my helper function for sending emails gets the following error:
com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', 'The ...
0
votes
1
answer
112
views
Error: module 'win32process' has no attribute 'GetWindowThreadProcessId'
as the title says, python 3.10 doesn't find GetWindowThreadProcessId() in the win32process library. I've taken a while to search for this error but it seems to work for everyone else.
I am running my ...
0
votes
0
answers
117
views
Word bullets and numbering using Python
I'm writing a code that transforms a Word document into a different format. Well, I've made the rest of the changes, but I'm having a problem with the numbering and bullets. I'd like to keep them. I'...
0
votes
0
answers
78
views
Programmatically querying/toggling Windows "Show my taskbar on all displays" via Python
I have an application in which I need to (at least while it's running) show the taskbar on all Windows displays, so I'm looking for a way to programmatically toggle the Windows "Show my taskbar ...
0
votes
0
answers
71
views
Open Word document as "Read Only" with API doesn't work
I'm using Python to open a Word file using the win32 API. When "RO=False", it opens the Word file and the user can edit it. When the user opens the file using Word's built-in feature "...
0
votes
2
answers
145
views
How to access "Groups" folder in Outlook using pywin32
I am trying to read emails of a particular mail group using pywin32 which, is showing under "Groups" of my outlook mail (shown in screenshot). I am able to access all the folders under my ...
0
votes
0
answers
51
views
pywin32 GetShortPathName cannot find a path which certainly exists
I've recently had the misfortune to learn about Windows short paths, and am using pywin32 to deal with them. It was working fairly well, but then I got an error
error: (3, 'GetShortPathNameW', 'The ...
0
votes
0
answers
69
views
Issue with Positioning Images and Pipelines in Word Documents Using win32com
I want the top pipeline to be closer to the image when the photo is placed at the top of the page. The pipeline appears on the previous page but is at the same height as the other bottom pipeline.
I ...
1
vote
0
answers
54
views
pywin32: Word.Documents.Open(filename) wants a string, how can I give it a BytesIO instead (without saving to disk)?
The function win32com.client.gencache.EnsureDispatch('Word.Application').Documents.Open()
wants a filename as input, to open an existing word doc. I have a doc created in memory with docx and would ...
0
votes
0
answers
33
views
Cannot add CustomDocumentProperties to word using pywin32 (version 310)
I have the code:
import win32com.client as com_obj
if __name__ == "__main__":
word_app = com_obj.Dispatch("Word.Application")
word_app.Visible = True
word_doc = ...
0
votes
0
answers
42
views
Can't exit program - win32gui PumpMessages
I have code that needs to detect when a new media device is attached / detached.
I have copied some code based on pywin32 to do so:
import win32api, win32con, win32gui
from ctypes import *
from ...
0
votes
0
answers
27
views
How window splitter is done in pywin32?
I have been interested on win32 programming via pywin32 in python, but the document seems to be vague on how to create splitters, buttons and other things inside the main window.
As far as I have ...
0
votes
0
answers
40
views
How to subscribe to an event with qbxml in Quickbooks Desktop using its SDK?
I am trying to subscribe to an event in QB using pywin32. I found an documentation and tried their sample code: https://developer.intuit.com/app/developer/qbdesktop/docs/develop/tutorials/subscribing-...
0
votes
0
answers
30
views
How do I pass in arguments when initializing an event handler with win32com.client.WithEvents in python
I am trying to use win32com.client.WithEvents and I'd like to be able to pass values to the initialization method. However, the input for the event handler is the class, not an instance of the class:
...
0
votes
0
answers
54
views
How to exit a Python Win32 GUI program on Ctrl-C from invoking console
I have a simple Python Win32 program that works well when run under pythonw from a command prompt. When I run it under python, it keeps running in the foreground of the command prompt and can e.g. ...
1
vote
1
answer
240
views
Reticulate with pywin32, a dependency of xlwings, not found when sourcing python script from R [duplicate]
Overview
I have a python script opens an excel workbook, makes some changes, then saves it. This is just one step in a series of excel processing operations, most of which are written in R. My end ...
0
votes
1
answer
92
views
How to suppress popup dialog box when converting pdf to docx using pywin32
I'm running a python script on a windows laptop to convert some sample pdf files to docx. However, for each file, a dialog box pops up that prompts me to click OK when the script tries to convert said ...
0
votes
1
answer
62
views
How I can SetWindowDisplayAffinity to WDA_NONE of game window?
How can I use SetWindowDisplayAffinity() on a game window to set it to WDA_NONE so it can be captured with win32gui.GetWindowDC(self.hwnd) or any other frame capturing tool?
Code below results in ...
2
votes
2
answers
84
views
AutoCAD win32com PDF Export - Custom Scale Issue
I'm trying to convert a DWG file to a PDF using win32com.client in Python, while applying a custom scale of 0.2 . However, the resulting PDF does not have the expected scale.
Here is the code I'm ...
-1
votes
1
answer
134
views
How to automate "Retry" on error when copying a file with the Windows Explorer COM model?
I'm automating specific copy operations (that can't be done via normal filesystem copy) with Windows Explorer COM:
import pythoncom
from win32comext.shell import shell
fo = pythoncom.CoCreateInstance(...
1
vote
0
answers
71
views
How can I handle specific exceptions in Python pywintypes instead of as a generic one?
I would like to handle a "pywintypes.error: (3, 'GetVolumeInformation', 'The system cannot find the path specified.')" exception when I try to access volume information on a NAS drive ...
1
vote
0
answers
53
views
How to insert text into Windows Text Controls
I am trying to become more familiar with programming GUI applications on Windows that interface with the OS. As a starting project, I want to build an App similar to Grammarly.
The app should do the ...
1
vote
2
answers
200
views
pywin32 - Windows COM dispatch works as standalone script but fails as service
I'm attempting to start a service that in turn requires the use of a separate application (EBSILON Professional; https://www.ebsilon.com/en/). The application is installed on the server, and when ...
2
votes
0
answers
323
views
PyWin32 throws "pywintypes com_error call was rejected" error, but only when NOT running from CMD
System setups:
Development PC: Win 10,Python 3.7.7, PyInstaller 5.3.12
Deployment PC: Win11, No Python installled
I've made a CLI python script (running from Windows CMD) with the following simple ...
1
vote
0
answers
101
views
Using pywin32 and flask to build a windows update scanner and i am having a problem where any function using COM objects blocks the next function
As the title states, i am trying to build a remote windows update scanner in python using pywin32 and flask. My intended functionality is for a listener to receive a post request to the /trigger ...
0
votes
1
answer
93
views
How to set the working directory for a Windows service created with pywin32
While creating a systemd service in linux, I could specify a WorkingDirectory in the service unit file. Is there any way to configure the working directory for a Windows service as well. I have some ...
0
votes
1
answer
61
views
Python Async Function not updating timestamp
I have a machine running some scripts that I need to keep an eye on.
I have set up a script in python to send me emails using every hour.
I would like to add timestamp to it so that I can see at a ...
0
votes
1
answer
97
views
Error in pip install pypiwin32 in Dockerfile
I am trying to add python modules in Docker. My Dockerfile looks like:
FROM python:3.9
ADD ./src ./src
# ADD main.py .
RUN pip install --upgrade pip
RUN pip install pyyaml
RUN pip install ...
0
votes
0
answers
78
views
How to make the windows icon bigger than 16x16?
I am having a problem not being able to make the window icon bigger than 16x16. It is awfully too small.
import os
import sys
import win32gui
import win32con
from PySide6.QtCore import Qt
from PySide6....
4
votes
0
answers
399
views
When I'm using BitBlt() to capture a screenshot of my explorer, the captured title bar is black and shifted position
I'm trying to capture a window by its HWND, like my explorer:
But this is the result I get:
This is the function I am using:
def capture_window(hwnd):
win32gui.ShowWindow(hwnd, win32con....
0
votes
1
answer
186
views
pywin32 EnumWindows throws "The specified module could not be found" error on Windows 10
I'm trying to write a Python script on Windows 10 that finds a window by its title and then moves/resizes it using pywin32. I have the following code:
import win32gui
# Global variables
found_hwnd = ...
1
vote
0
answers
28
views
Setting xy position of Popen object and closing object
I can open the OSK keyboard for windows in Python using Popen but cannot set the xy position or close it on event. I have tried to set the xy position of it adapting the answer from this:
``
Changing ...
0
votes
0
answers
50
views
How to update multiple origin OLEs embedeed in Power Point?(Python,OriginPro)
I really need your help. I would greatly appreciate any advice you can give.
I am trying to sequentially open multiple OriginPro OLE objects embedded in a PowerPoint slide and automatically update the ...
0
votes
0
answers
131
views
Error when converting GUI to a standalone executable using pyinstaller
I get a lot of error messages when I run the code pyinstaller --onefile --windowed --clean Todo_gui.py and an empty dist folder
Typed out below are the full error messages I get when I run the code
...
1
vote
0
answers
136
views
Using IUnknown-derived interface in python / pywin32
In short: I'm trying to call a method on in IUknown-based interface. I have some parts, but they don't connect.
Situation:
o1 = win32com.client.Dispatch("SomeProgId")
o2 = o1.SubObject
The ...
0
votes
0
answers
67
views
Installing cantools in msys2 in venv
I'm trying to get cantools package working in a venv inside MSYS2 installation (on Windows). But it requires python-can, which requires pywin32. I did install mingw-w64-x86_64-python-pywin32 and the ...
1
vote
0
answers
131
views
PyInstaller no longer works; "AttributeError: Failed to retrieve attribute __file__ from module pythoncom"
My copy of PyInstaller (executed with my Spyder editor) worked fine for months, and then one day I turned my computer off and on again, and the program which had worked one hour before no longer ...
2
votes
1
answer
105
views
Unable to set any property when protecting an excel worksheet using pywin32
I am using pywin32 for a project to automate a few excel files using python.
In the excel file, I want to protect all the cells that contain a formula.
So, I first unlock all the cells and then only ...
2
votes
1
answer
173
views
How to listen for hotkeys in a separate thread using Python with Win32 API and PySide6?
I’m setting up a hotkey system for Windows in Python, using the Win32 API and PySide6. I want to register hotkeys in a HotkeyManager class and listen for them in a separate thread, so the GUI remains ...
2
votes
1
answer
58
views
How to Close All Excel Files in a Specific Directory Using Python?
I'm working on automating some tasks using Python, and one of the requirements is to close all Excel files that are currently open in a specific directory. I often have multiple Excel files open from ...
0
votes
1
answer
90
views
SetWindowsHookExW returns 0 with no error | HID Mouse hook attempt
I'm trying to intercept an HID "Mice/other poninting device" left button clicks, and I'm just losing it. I'm running on 64bits Win 11 if it makes any difference.
SetWindowsHookExW returns 0 &...
0
votes
1
answer
47
views
Outlook Error: LDAP Query Exceeds Limit When Sending Email Using win32com
Description:
I'm working with the win32com.client module in Python to send emails via Outlook. I saw that the email is instantiated as a CDispatch object. However, I encounter an LDAP error when ...
0
votes
1
answer
97
views
Creating a standalone python executable with pywin32 and missed required module
I'm going to create a standalone python executable that rely on a python interpreter on windows (I don't want to create an exe file).
So, I'm used this helpful article:
https://n8henrie.com/2022/08/...
0
votes
1
answer
49
views
why the pywin32 service work when running by administrator account but not work by local system account?
I wrote a python script running as windows service to reversely forward a port. The service works ok when it logged on by the administrator account. But when it logged on by local system account, the ...
0
votes
1
answer
75
views
Is there a way for python to update an excel slicer in non-interactive mode?
I have a python script that refreshes data connections, updates slicers and filters.
I'm using pywin32 to update my excel file. As I understand, updating excel slicers and filters requires COM ...
0
votes
0
answers
35
views
Obtuse issues with bitmap derived screenshots
I have these functions in my program, which are supposed to take a screenshot of a specific application by copying its bitmap data and then crop that down to specific coordinates. Last night I was ...
0
votes
1
answer
232
views
Python/win32crypt, "Access is denied" when trying to save a certificate to "local machine" Windows store, but working with "current user" store
Solved: I just had to select run as administrator for PyCharm and the executable.
I have a Python program that creates a self-signed certificate, and now I am trying to add a feature that saves that ...
0
votes
1
answer
579
views
Creating/Updating an excel file with slicers from python
I have some python code which creates a few pandas data frames which I need to put into a spreadsheet, with different data on multiple sheets and with slicers for easy filtering. This then gets sent ...