</head> <body> <h1>SetWinDelay</h1> <p>Sets the delay that will occur after each windowing command, such as <a href="WinActivate.htm">WinActivate</a>.</p> <pre class="Syntax"><span class="func">SetWinDelay</span>, Delay</pre> <h2 id="Parameters">Parâmetros</h2> <dl> <dt>Delay</dt> <dd><p>Time in milliseconds, which can be an <a href="../Variables.htm#Expressions">expression</a>. Use -1 for no delay at all and 0 for the smallest possible delay. If unset, the default delay is 100.</p></dd> </dl> <h2 id="Remarks">Remarks</h2> <p>A short delay (sleep) is done automatically after every windowing command, built-in function and control flow statement except <a href="WinActive.htm">WinActive()</a>, <a href="IfWinActive.htm">IfWinActive</a>, <a href="WinExist.htm">WinExist()</a> and <a href="IfWinExist.htm">IfWinExist</a>. This is done to improve the reliability of scripts because a window sometimes needs a period of "rest" after being created, activated, minimized, etc. so that it has a chance to update itself and respond to the next command that the script may attempt to send to it.</p> <p>Although a delay of -1 (no delay at all) is allowed, it is recommended that at least 0 be used, to increase confidence that the script will run correctly even when the CPU is under load.</p> <p>A delay of 0 internally executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it. If there is none, Sleep(0) will not sleep at all.</p> <p>If the CPU is slow or under load, or if window animation is enabled, higher delay values may be needed.</p> <p>The built-in variable <strong>A_WinDelay</strong> contains the current setting.</p> <p>Every newly launched <a href="../misc/Threads.htm">thread</a> (such as a <a href="../Hotkeys.htm">hotkey</a>, <a href="Menu.htm">custom menu item</a>, or <a href="SetTimer.htm">timed</a> subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).</p> <h2 id="Related">Tópicos relacionados</h2> <p><a href="SetControlDelay.htm">SetControlDelay</a>, <a href="SetKeyDelay.htm">SetKeyDelay</a>, <a href="SetMouseDelay.htm">SetMouseDelay</a>, <a href="SetBatchLines.htm">SetBatchLines</a>, <a href="SendMode.htm">SendMode</a></p> <h2 id="Examples">Exemplos</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> Causes a delay of 10 ms to occur after each windowing command.</p> <pre>SetWinDelay, 10</pre> </div> </body> </html>