Skip to content
Advertisement

Tag: pywin32

Converting Excel to PDF with pywin32 [Error]

I try to export one of my xlsx files as PDF with pywin32: Unfortunately I get this com_error: In the end I want to do use this conversion on 30 xlsx files at once. I know how to write the loop for this but can not fix the above mentioned error. Answer When using Python paths on Windows, you need

Python: how to get Windows desktop background color

Context: on my office PC there is apllied corporate policy -> standard company picture on desktop wallpaper. Picture is too bright; I switch it off to more dark backgroubd color, do it by manually running the script several times per day. Aim: automate this operation with Python once per some time check some desktop background pixel if it color is

pywintypes.com_error: (-2147221008, ‘CoInitialize has not been called.’, None, None)

When I try to run this code as is I get this error “IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) pywintypes.com_error: (-2147221008, ‘CoInitialize has not been called.’, None, None)” , however if I run stp_tracker alone it works fine and if I run notify stp’s alone it works just fine. I appreciate anyones input. Thanks Answer Apologize for that, but searching

How to mute/unmute sound using pywin32?

My searches lead me to the Pywin32 which should be able to mute/unmute the sound and detect its state (on Windows 10, using Python 3+). I found a way using an AutoHotkey script, but I’m looking for a pythonic way. More specifically, I’m not interested in playing with the Windows GUI. Pywin32 works using a Windows DLL. so far, I

How can I use SetJob in win32print?

I want to clear or delete print jobs using Python. But how can I get JobID? win32print.SetJob(hPrinter, JobID , Level , JobInfo , Command) How could I run this code? Answer Starting from your code, I’ve managed to create a small script that deletes any print job on any (local) printer (I’ve tested it and it works). Here it is

Get Printer Status Code with win32print

I have read the documentation of win32print which indicates that GetPrinter is the method which is used to obtain the status of the printer. However, this method returns a complete tuple of data and I’m at a loss at to which element indicates the actual status. Any ideas? Answer If you pass Level=2 into GetPrinter it should return a dict.

Advertisement