<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1632085368384154" crossorigin="anonymous"></script><script src="https://autohotkey.top/gtag.js"></script></head> <body> <h1>Until <span class="ver">[AHK_L 59+]</span></h1> <p>根据条件判断是否继续执行 Loop 或 For 循环.</p> <pre class="Syntax"> <span class="func">Loop</span> { ... } <span class="func">Until</span> <i>Expression</i> </pre> <h2 id="Parameters">参数</h2> <dl> <dt>Expression</dt> <dd><p>任何有效的<a href="../Variables.htm#Expressions">表达式</a>.</p></dd> </dl> <h2 id="Remarks">备注</h2> <p>在每次重复执行后都会计算一次表达式, 即使使用了 <a href="Continue.htm">continue</a> 也会进行计算. 如果表达式计算结果为 false(即为空字符串或数值 0), 循环继续; 否则循环被打破且跳到 <i>Until</i> 之后一行执行.</p> <p>Loop Until 是下列结构的简写形式:</p> <pre>Loop { ... if (<i>Expression</i>) break }</pre> <p>不过, Loop Until 通常更容易理解, 且与上面不同的是, 它还可以使用单行动作. 例如:</p> <pre>Loop x *= 2 Until x &gt; y</pre> <p><i>Until</i> 可以使用在任何 Loop 或 For 循环中. 例如:</p> <pre>Loop, Read, %A_ScriptFullPath% lines .= A_LoopReadLine . "`n" Until A_Index=5 <em>; 读取前五行.</em> MsgBox % lines </pre> <p>如果 <a href="../Variables.htm#Index">A_Index</a> 用在 <i>Expression</i> 中, 那么它的值为刚结束的那次循环的索引.</p> <h2 id="Related">相关</h2> <p><a href="Loop.htm">Loop</a>, <a href="While.htm">While 循环</a>, <a href="For.htm">For 循环</a>, <a href="Break.htm">Break</a>, <a href="Continue.htm">Continue</a>, <a href="Block.htm">区块</a>, <a href="LoopFile.htm">文件和文件夹循环</a>, <a href="LoopReg.htm">注册表循环</a>, <a href="LoopReadFile.htm">文件读取循环</a>, <a href="LoopParse.htm">解析循环</a>, <a href="IfExpression.htm">If (表达式)</a></p> <a href="https://dftg.net">dftg</a><!-- Cloudflare Pages Analytics --><script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "d5a9c4fcb9b6482fa53ce820d892f969"}'></script><!-- Cloudflare Pages Analytics --><script defer src="https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon='{"rayId":"95b8c75b5a9df65c","version":"2025.6.2","r":1,"serverTiming":{"name":{"cfExtPri":true,"cfEdge":true,"cfOrigin":true,"cfL4":true,"cfSpeedBrain":true,"cfCacheStatus":true}},"token":"51750bb5dc4f40cc91a5ec55c63bbc01","b":1}' crossorigin="anonymous"></script> </body> </html>