- 目录
- 索引
- AutoHotkey
- 指南(快速入门)
- FAQ(常见问题)
- 命令和函数索引
- 脚本展示
- 更新历史
- ►基本用法和语法
- 热键
- 热字串和自动替换
- 重映射按键和鼠标按钮
- 按键列表(键盘、鼠标和操纵杆)
- 脚本
- 变量和表达式
- 函数
- 调试(DBGp)客户端
- ►对象
- 基本用法
- 扩展用法
- 自定义对象
- 默认基对象
- 实现
- 对象
- 枚举器对象
- File 对象
- Func 对象
- ►迁移到 AutoHotkey 1.1(AutoHotkey_L)
- AutoHotkey_L 新特性
- 脚本兼容性
- ►环境管理
- ClipWait
- EnvGet
- EnvSet
- EnvUpdate
- ►本机代码互操作
- DllCall
- NumGet
- NumPut
- RegisterCallback
- StrPut()/StrGet()
- ►COM
- ComObjActive
- ComObjArray
- ComObjConnect
- ComObjCreate
- ComObjGet
- ComObjError
- ComObjFlags
- ComObjQuery
- ComObjType
- ComObjValue
- ObjAddRef / ObjRelease
- ►文件、目录和磁盘管理
- Drive
- DriveGet
- DriveSpaceFree
- FileAppend
- FileCopy
- FileCopyDir
- FileCreateDir
- FileCreateShortcut
- FileDelete
- FileEncoding
- FileGetAttrib
- FileGetShortcut
- FileGetSize
- FileGetTime
- FileGetVersion
- FileInstall
- FileMove
- FileMoveDir
- FileOpen()
- FileReadLine
- FileRead
- FileRecycle
- FileRecycleEmpty
- FileRemoveDir
- FileSelectFile
- FileSelectFolder
- FileSetAttrib
- FileSetTime
- IfExist/IfNotExist
- IniDelete
- IniRead
- IniWrite
- Loop(文件和文件夹)
- Loop(读取文件内容)
- SetWorkingDir
- SplitPath
- ▼流程控制
- #Include/#IncludeAgain
- { ... }(区块)
- Break
- Catch
- Continue
- Critical
- Else
- Exit
- ExitApp
- Finally
- For 循环
- Gosub
- Goto
- ►If 命令
- If(传统型)
- If(表达式)
- If var [not] between Low and High
- If var is [not] type
- If var [not] in/contains MatchList
- IfExist/IfNotExist
- IfInString/IfNotInString
- IfMsgBox
- IfWinActive/IfWinNotActive
- IfWinExist/IfWinNotExist
- ►Loop 命令
- Loop
- Loop(文件和文件夹)
- Loop(解析字符串)
- Loop(读取文件内容)
- Loop(注册表)
- OnExit
- Pause
- Reload
- Return
- SetBatchLines
- SetTimer
- Sleep
- Suspend
- Thread
- Throw
- Try
- Until
- While 循环
- ►内置函数
- Asc
- Chr
- FileExist
- GetKeyName/VK/SC
- GetKeyState
- InStr
- IsByRef
- IsFunc
- IsLabel
- NumGet
- NumPut
- OnMessage
- RegExMatch
- RegExReplace
- RegisterCallback
- StrLen
- StrPut()/StrGet()
- StrSplit
- SubStr
- VarSetCapacity
- WinActive
- WinExist
- ►GUI、MsgBox、InputBox 及其他对话框
- FileSelectFile
- FileSelectFolder
- Gui
- Gui 控件类型
- GuiControl
- GuiControlGet
- Gui ListView 控件
- Gui TreeView 控件
- IfMsgBox
- InputBox
- Menu
- MsgBox
- OnMessage
- Progress
- SplashImage
- SplashTextOn/SplashTextOff
- ToolTip
- TrayTip
- ►鼠标和键盘
- ►热键和热字串
- #HotkeyInterval
- #HotkeyModifierTimeout
- #Hotstring
- #If
- #IfTimeOut
- #IfWinActive/Exist
- #InputLevel
- #MaxHotkeysPerInterval
- #MaxThreads
- #MaxThreadsBuffer
- #MaxThreadsPerHotkey
- #MenuMaskKey
- #UseHook
- Hotkey
- ListHotkeys
- Suspend
- #InstallKeybdHook
- #InstallMouseHook
- #KeyHistory
- BlockInput
- Click
- ControlClick
- ControlSend/ControlSendRaw
- CoordMode
- GetKeyState
- 按键列表(键盘、鼠标和操纵杆)
- KeyHistory
- KeyWait
- Input
- MouseClick
- MouseClickDrag
- MouseGetPos
- MouseMove
- Send/SendRaw/SendInput/SendPlay/SendEvent
- SendLevel
- SendMode
- SetDefaultMouseSpeed
- SetKeyDelay
- SetMouseDelay
- SetNumScrollCapsLockState
- SetStoreCapslockMode
- ►数学相关
- Abs
- Ceil
- Exp
- Floor
- Log
- Ln
- Mod
- Random
- Round
- SetFormat
- Sqrt
- Sin/Cos/Tan
- ASin/ACos/ATan
- Transform
- ►屏幕管理
- ImageSearch
- PixelGetColor
- PixelSearch
- ►杂项命令
- #NoTrayIcon
- #SingleInstance
- #Warn
- AutoTrim
- Edit
- ListLines
- ListVars
- OutputDebug
- SysGet
- Transform
- URLDownloadToFile
- VarSetCapacity
- ►进程管理
- Process
- Run/RunWait
- RunAs
- Shutdown
- ►注册表管理
- Loop(注册表)
- RegDelete
- RegRead
- RegWrite
- SetRegView
- ►声音命令
- SoundBeep
- SoundGet
- SoundGetWaveVolume
- SoundPlay
- SoundSet
- SoundSetWaveVolume
- ►字符串管理
- FormatTime
- IfInString/IfNotInString
- If var [not] in/contains MatchList
- InStr()
- Loop(解析字符串)
- RegExMatch()
- RegExReplace()
- SetEnv (var = value)
- SetFormat
- Sort
- StringCaseSense
- StringGetPos
- StringLeft/StringRight
- StringLen
- StringLower/StringUpper
- StringMid
- StringReplace
- StringSplit
- StringTrimLeft/StringTrimRight
- StrLen()
- StrPut()/StrGet()
- StrSplit()
- SubStr()
- Trim()
- ►窗口管理
- ►控件
- Control
- ControlClick
- ControlFocus
- ControlGet
- ControlGetFocus
- ControlGetPos
- ControlGetText
- ControlMove
- ControlSend/ControlSendRaw
- ControlSetText
- Menu
- PostMessage/SendMessage
- SetControlDelay
- WinMenuSelectItem
- ►窗口组
- GroupActivate
- GroupAdd
- GroupClose
- GroupDeactivate
- #WinActivateForce
- DetectHiddenText
- DetectHiddenWindows
- IfWinActive/IfWinNotActive
- IfWinExist/IfWinNotExist
- SetTitleMatchMode
- SetWinDelay
- StatusBarGetText
- StatusBarWait
- WinActivate
- WinActivateBottom
- WinClose
- WinGet
- WinGetActiveStats
- WinGetActiveTitle
- WinGetClass
- WinGetPos
- WinGetText
- WinGetTitle
- WinHide
- WinKill
- WinMaximize
- WinMinimize
- WinMinimizeAll/WinMinimizeAllUndo
- WinMove
- WinRestore
- WinSet
- WinSetTitle
- WinShow
- WinWait
- WinWaitActive/WinWaitNotActive
- WinWaitClose
- ►#指令
- #AllowSameLineComments
- #ClipboardTimeout
- #CommentFlag
- #ErrorStdOut
- #EscapeChar
- #HotkeyInterval
- #HotkeyModifierTimeout
- #Hotstring
- #If
- #IfWinActive/Exist
- #IfTimeout
- #Include/#IncludeAgain
- #InputLevel
- #InstallKeybdHook
- #InstallMouseHook
- #KeyHistory
- #MaxHotkeysPerInterval
- #MaxMem
- #MaxThreads
- #MaxThreadsBuffer
- #MaxThreadsPerHotkey
- #MenuMaskKey
- #NoEnv
- #NoTrayIcon
- #Persistent
- #SingleInstance
- #UseHook
- #Warn
- #WinActivateForce
Until [AHK_L 59+]
根据条件判断是否继续执行 Loop 或 For 循环。
Loop { ... } Until Expression
参数
- Expression
任何有效的 表达式.
备注
在每次重复执行后都会计算一次表达式, 即使使用了 continue 也会进行计算. 如果表达式计算结果为 false (即为空字符串或数值 0), 循环继续; 否则循环被打破且跳到 Until 之后一行执行.
Loop Until 是下列结构的简写形式:
Loop { ... if (Expression) break }
不过, Loop Until 通常更容易理解, 且与上面不同的是, 它还可以使用单行动作. 例如:
循环 x *= 2 Until x > y
Until 可以使用在任何 Loop 或 For 循环中. 例如:
Loop, Read, %A_ScriptFullPath% lines .= A_LoopReadLine . "`n" Until A_Index=5 ; 读取前五行. MsgBox % lines
如果 A_Index 用在 Expression 中, 那么它的值为刚结束的那次循环的索引.
相关
Loop, While 循环, For 循环, Break, Continue, 区块, 文件和文件夹循环, 注册表循环, 文件读取循环, 解析循环, If (表达式)