Nikhil Tumme
Nikhil Tumme

Reputation: 9

Slow down AutoIt without explicit Sleep() statements

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?

Upvotes: 0

Views: 3626

Answers (2)

Peter Mortensen
Peter Mortensen

Reputation: 31586

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."

Upvotes: 4

Daniel Haley
Daniel Haley

Reputation: 52858

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.

Upvotes: 3

Related Questions