Не удается открыть блокнот с помощью autoit с python

Я хочу открыть блокнот и выполнить какую-то задачу, но он не открывается. я пробовал этот код

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

блокнот не открывается, но все работает

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

person Kneerudge    schedule 01.05.2014    source источник


Ответы (1)


Попробуйте сделать что-то вроде этого :

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

Затем попробуйте так:

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

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

Описание параметров функции Run вы можете найти здесь. Целочисленные значения параметра show_flag вы можете найти здесь (5 соответствует SW_SHOW)

person NorthCat    schedule 01.05.2014
comment
спасибо, этот autoit.Run(notepad.exe,'',5) помог, я уже зарегистрировал AutoItX3.dll и AutoItX3_x64.dll - person Kneerudge; 02.05.2014