exe_file := "test.exe"
Gui, Add, text, x0 y0 w60 h20, 源文件
Gui, Add, Edit, x60 y0 w200 h20 vsource_file
Gui, Add, text, x0 y20 w60 h20, 进程数
Gui, Add, Edit, x60 y20 w200 h20 vmax, 10
Gui, Add, Button, x0 y40 w160 h20 gstart vstart, 开始
gui, Add, text, x0 y60 w160 h100 vshow
Gui, Show, x0 y0, 多进程示例
return
start:
GuiControl, Disable, start
Gui, Submit, nohide
FileRead, content, % source_file
Loop, Parse, content, `n, `r
{
while(!check_idle())
Sleep, 1000
info := StrSplit(res,",")
GuiControl, , show, % "信息:" info[1] " " info[2] "`n本次运行数量:" A_index "`n当前线程数:" p.maxindex()+1
Run, % exe_file " " info[1] " " info[2], , , pid ;传参方式传递数据
p.Push(pid)
}
return
GuiClose:
ExitApp
check_idle(){
global p,max
for k,v in p
{
Process, Exist, % v
if !ErrorLevel
p.RemoveAt(k)
}
return (p.maxindex()<max)
}
60 queries in 1.705 seconds |