jkluio668
12/3/2017 - 4:50 AM

judge_process

[1]
loop
{
	Sleep, 60000 ;设定为每60秒一检查
	return1 := judge_process_title("chrome_page_find1") ;arg1:伴随打开的ahk的匹配字段
	if WinExist("ahk_exe chrome.exe") ;arg2:目标进程
	{
		if  return1=0
		{
			;'MsgBox,'1'
			Run, H:\Program Files (x86)\ahk\chrome_page_find1.ahk ;arg3:伴随打开的ahk的路径
		}
	}
	else
	{
		if  return1<>0
		{
			;MsgBox,'0'
			WinClose,%return1% ahk_class AutoHotkey
		}
	}
}


judge_process_title(reg1){
	DetectHiddenWindows On
	WinGet, AHKWinList, List, ahk_class AutoHotkey
	loop, %AHKWinList%
	{
		AHKWinHWND := AHKWinList%A_Index%
		WinGetTitle, AHKWinTitle, ahk_id %AHKWinHWND%
		;WinGet, AHKWinProcessPath, ProcessPath, ahk_id %AHKWinHWND%
		RegExMatch(AHKWinTitle ,".*?(" reg1 ").*?" ,name)
		if  (name){
			return, AHKWinTitle
			break
		}
		;MsgBox, % "脚本标题:" AHKWinTitle "`n脚本进程路径:" AHKWinProcessPath
	}
	return, 0
}

https://autohotkey.com/docs/commands/Process.htm#ListEx	Process-ahk


[1]设定自启动的时间

folder = F:\Run
Loop, %folder%\*.lnk
{
runwait %folder%\%A_LoopFileName%
; runwait 命令,等一个程序启动完成之后再循环启动下一个程序,直到循环自动退出。
}
ExitApp
; 自动退出

将快捷方式放入F:\Run