Slow down AutoIt without explicit Sleep() statements

给你一囗甜甜゛ 提交于 2019-12-13 05:40:47

问题


I am trying to explore AutoIt for automation. Is there a way to increase execution time (wait) rather than use Sleep(3000) after each syntax/command?


回答1:


The interval between key presses and mouse clicks can be set with AutoItSetOption, with parameters "MouseClickDownDelay" and "SendKeyDelay", respectively. This will cause a general slowdown of the script without requiring Sleep statements.

Sample:

AutoItSetOption("MouseClickDownDelay", 200)  ; Unit: ms. "Alters the length a click is held
                                             ; down before release."

AutoItSetOption("SendKeyDelay", 100)  ; Unit: ms.  "Alters the length of the brief pause in
                                      ;            between sent keystrokes. A value of 0 removes
                                      ;            the delay completely."



回答2:


The Sleep() function pauses script execution. When you say "increase execution time", it sounds like you are waiting on something instead of just trying to pause the script.

Check out the following functions in the AutoIt help:

  • ProcessWait()
  • RunWait()
  • ShellExecuteWait()
  • WinWait()
  • WinWaitActivate()
  • WinWaitClose()
  • WinWaitDelay (this is an option, not a function)
  • WinWaitNotActive()

Maybe one of these will help you with what you're trying to do.



来源:https://stackoverflow.com/questions/4526223/slow-down-autoit-without-explicit-sleep-statements

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!