pywin32

How to use timer in pywin32

How to use timer in pywin32 Question: I want the logging function to run every 1 second using Python and pywin32 timer module. Here is my code import timer i = 0 def logging(): global i print(str(i)) i += 1 timer.set_timer(1000, logging) However I don’t see any output on screen. I’m not sure what I’m …

Total answers: 1

How do you access the "remembered" location of a Windows network drive via Python?

How do you access the "remembered" location of a Windows network drive via Python? Question: I’m using the pywin32 Windows API library to pull information about network drives using the win32wnet.WNetGetConnection() function. When I perform this function on network drives Windows reports as "Unavailable" (Status), the function returns a win32wnet.error stating "The device is not …

Total answers: 1

ctypes.ArgumentError: argument 1: TypeError: Don't know how to convert parameter 1

ctypes.ArgumentError: argument 1: TypeError: Don't know how to convert parameter 1 Question: my code.. import ctypes import win32security h_token = win32security.OpenProcessToken(ctypes.windll.kernel32.GetCurrentProcess(), win32security.TOKEN_ALL_ACCESS) lpApplicationName = ctypes.c_wchar_p(rf"C:\Windows\System32\cmd.exe") lpCommandLine = ctypes.c_wchar_p("") dwCreationFlags = 0x00000010 lpEnvironment = None lpProcessAttributes = None lpThreadAttributes = None bInheritHandles = False ctypes.windll.advapi32.CreateProcessWithTokenW(h_token, 0, lpApplicationName, lpCommandLine, dwCreationFlags, lpEnvironment, None, lpProcessAttributes, lpThreadAttributes, bInheritHandles) my output… …

Total answers: 2

shutil.move() not working after reading object with pywin32

shutil.move() not working after reading object with pywin32 Question: I’ve got a script that is intended to sort my photo/video collection (Windows). The photos work fine as they are sortable by EXIF which is easily accessed. Videos are harder because I have to get the file’s "Media Creation Date" which is readable by only pywin32, …

Total answers: 1

Win32 not recognising the outlook email in Jupyter notebook

Win32 not recognising the outlook email in Jupyter notebook Question: Tried to read the outlook email in jupyter notebook for creating a ML algorithm but the win32 is not recognising my outlook account. It was working fine yesterday but somehow same code not wrking today. Any suggestions please? Attached my code below. import win32com #.client …

Total answers: 2

Unable to install pypiwin32 library

Unable to install pypiwin32 library Question: Tried to install the pip install pypiwin32 in Google Colab for reading outlook emails. But the installation keeps on getting failed. Tried by downgrading the python version to 3.9 as well, but didn’t worked. Any suggestions for fixing the issue? Asked By: Pravin || Source Answers: Are you running …

Total answers: 2

Copying the icon of target file to its shortcut in Python

Copying the icon of target file to its shortcut in Python Question: I’m a beginner at programming and recently started experimenting with creating shortcuts using python. I know how to create a shortcut using win32com client but was wondering how to copy the same icon of the target file to its shortcut that is being …

Total answers: 1

Pywin32 COM not able to set attribute keyerror

Pywin32 COM not able to set attribute keyerror Question: I’m trying to automate something using its com interface. There are some problems which I can’t get my head around. app = DispatchEx(‘CANoe.Application’) configs = app.Configuration.TestConfigurations config = configs.Item(1) unit = config.TestUnits.Item(1) unit.Name unit.Enabled Until here it is fine, name and enabled will print out a …

Total answers: 1

Unable to save email attachment from outlook to local drive

Unable to save email attachment from outlook to local drive Question: i have written the below code to save email attachment from outlook with specific subject but its throwing an error. Below is the code : import win32com.client import os outlook = win32com.client.Dispatch(‘outlook.application’).GetNamespace("MAPI") inbox = outlook.Folders(‘xyz.com’).Folders("Inbox") messages = inbox.Items for msg in messages: if ‘Subject’ …

Total answers: 1

How to change the mouse movement speed with win32api (mouseeventf_move)

How to change the mouse movement speed with win32api (mouseeventf_move) Question: So I basically have a python script set up that moves the mouse in a game to specific x and y coordinates, my question now is how can I make it so the mouse is moving slower, yet still smooth from point a to …

Total answers: 1