函数说明

ProcessWaitClose

暂停脚本的执行直至给定进程不再存在为止。

ProcessWaitClose ( "进程名" [, 超时时间] )

 

参数

进程名 目标进程的名称或 PID(进程标识符)。
超时时间 [可选参数] 指定要等待的时间长度(默认为一直等待)。

 

返回值

成功: 返回值为1。
失败: 返回值为0,说明已超时。

 

注意

进程名是指可执行文件的名称(无需给出完整路径),例如:"notepad.exe" 或 "winword.exe"
PID 是标识进程的唯一的数值。PID 可通过 ProcessExists 或 Run 命令的返回值获得。
为使 ProcessWaitClose 函数能在 Windows NT 4.0 下工作,系统还需要一个 DLL 文件(PSAPI.DLL,已包含在 AutoIt 的安装目录下)。
每隔 250 毫秒左右进程将被检测一次。

 

相关

ProcessClose, ProcessExists, ProcessWaitClose, RunWait, WinWaitClose

 

示例


;waits until no instance of notepad.exe exists
ProcessWaitClose("notepad.exe")

; This will wait until this particular instance of notepad has exited
$PID = Run("notepad.exe")
ProcessWaitClose($PID)