2

I want to open notepad and perform some task, but its not opening. i tried this code

import win32com.client
autoit = win32com.client.Dispatch("AutoItX3.Control")
autoit.Run("notepad.exe")

notepad doesn't open but these work fine

autoit.Run("calc.exe")
autoit.Run("explorer.exe")
autoit.Run("regedit")

1 Answer 1

4

Try to do something like this:

Open a command prompt window (cmd) as an administrator
Go to AutoItX directory (default on Windows 7 : cd C:\Program Files (x86)\AutoIt3\AutoItX\)
Type these two commands :
regsvr32.exe AutoItX3.dll
regsvr32.exe AutoItX3_x64.dll

Then, try so:

import win32com.client
autoit = win32com.client.Dispatch("AutoItX3.Control")

#Run(program, workingdir, show_flag)
autoit.Run("notepad.exe",'',5)

Description of the parameters for the function Run you can find here. Integer values for parameter show_flag you can find here (5 corresponds SW_SHOW)

Sign up to request clarification or add additional context in comments.

1 Comment

thanks, this " autoit.Run("notepad.exe",'',5) " helped, i had already registered AutoItX3.dll and AutoItX3_x64.dll

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.