Autoit信息无法显示Windows 10中计算器的ID Elemnet


    AutoItX x = new AutoItX();
    x.run("calc.exe");
    x.winActivate("Calculator");
    x.winWaitActive("Calculator");
    //Enter 3
    x.controlClick("Calculator", "", "201. 396") ;
    Thread.sleep(1000);
    //Enter +
    x.controlClick("Calculator", "", "35") ;
    Thread.sleep(1000);
    //Enter 3
    x.controlClick("Calculator", "", "201. 396") ;
    Thread.sleep(1000);
    //Enter =
    x.controlClick("Calculator", "", "276") ;

在Windows 7中运行相同的代码。自动录音机也无法正常工作。在Windows 10中该怎么办?

尝试以下:

; Win 7
; Run the Windows Calculator.
Run("calc.exe")
; Wait for the calculator to become active with a timeout of 10 seconds.
WinWaitActive("[CLASS:CalcFrame]", "", 10)
; If the calculator did not appear after 10 seconds then exit the script.
If WinExists("[CLASS:CalcFrame]") = 0 Then Exit
; Automatically type the 123456789 into the calculator.
ControlSend("[CLASS:CalcFrame]", "","[CLASS:#32770; INSTANCE:1]", '123456789')
; Slow the script down so we can see what's going on.
Sleep(6000)
; Close the Windows calculator - always tidy up afterwards.
WinClose("[CLASS:CalcFrame]")
; win10
; Run the Windows Calculator.
Run("calc.exe")
; Wait for the calculator to become active with a timeout of 10 seconds.
WinWaitActive("[CLASS:ApplicationFrameWindow]", "", 10)
; If the calculator did not appear after 10 seconds then exit the script.
If WinExists("[CLASS:ApplicationFrameWindow]") = 0 Then Exit
; Automatically type the 123456789 into the calculator.
ControlSend("[CLASS:ApplicationFrameWindow]", "","Windows.UI.Core.CoreWindow1", '123456789')
; Slow the script down so we can see what's going on.
Sleep(6000)
; Close the Windows calculator - always tidy up afterwards.
WinClose("[CLASS:ApplicationFrameWindow]")

相关内容

  • 没有找到相关文章

最新更新