ControlSend函数在AutoIt中不起作用(在python中调用)

时间:2016-07-04 07:14:23

标签: python autoit

  

在我的python脚本中,我将自动脚本转换为python脚本。除了ControlSend函数之外,Autoit脚本中的所有默认函数都工作正常。请参考下面的代码并指导我在脚本中出错。

    Auto = Dispatch("AutoItX3.Control")
    Auto.Run("calc.exe")
    time.sleep(1)
    Auto.Send("AZERTYUIOP = ")
    hwnd=Auto.WinGetHandle("[TITLE:Calculator; CLASS:CalcFrame]")
    time.sleep(1)
    titreFenetre = 'Calculatrice'
    Auto.WinActivate(titreFenetre , '')
    time.sleep(1)
    Auto.ControlSend(hwnd, "", hwnd, "12345") #ControlSend is not working
    Auto.Send("12345") #Send function is working
  

在上面的脚本中我正在使用python脚本编写器,Auto.ControlSend(hwnd,“”,hwnd,“12345”)无效(如果我在autoit中调用ControlSend函数它正在工作)。有没有办法将Autoit脚本转换为python。指导我

1 个答案:

答案 0 :(得分:0)

  

经过长时间的斗争,我找到了解决方案。我们的想法是在python脚本中运行Autoit脚本。我使用下面的行直接在python脚本中执行自动脚本。

import os
os.startfile("C:\\test.au3")
相关问题