我想打开记事本执行一些任务,但它没有打开。
我试过这个密码
import win32com.client
autoit = win32com.client.Dispatch("AutoItX3.Control")
autoit.Run("notepad.exe")
记事本没有打开,但这些很好用
autoit.Run("calc.exe")
autoit.Run("explorer.exe")
autoit.Run("regedit")
最佳答案
试着做一些像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
然后,尝试:
import win32com.client
autoit = win32com.client.Dispatch("AutoItX3.Control")
#Run(program, workingdir, show_flag)
autoit.Run("notepad.exe",'',5)
函数
Run
的参数说明,您可以找到here。参数show_flag
的整数值可以找到here(5对应SW_SHOW
)关于python - 无法通过python使用autoit打开记事本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23408223/